Forked from miligraf/rename_read_column_to_state.rb
Created
September 23, 2019 17:19
-
-
Save nmenag/819b9755d902bfbfaea4e70ea57f0b84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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