Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class RenameReadColumToState < ActiveRecord::Migration
def change
add_column :messages, :state, :integer, default: 0
execute "UPDATE messages SET state = CAST(read AS INTEGER);"
remove_column :messages, :read
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment