I have a migration AddAuthenticableToUser. (rake db:migrate:up VERSION=..) works fine, but when I'm trying to rollback a migration (rake db:migrate:down VERSION=..) it doesn't works. Any errors or warnings. Could you help me with this?
def self.up
change_table :users do |t|
t.token_authenticatable
end
add_index :users, :authentication_token, :unique => true
end
def self.down
remove_index :users, :authentication_token
remove_column :users, :authentication_token
end
This should be the trick. I think you named your table token_authenticatable and then tried to remove authentication_token.
def self.up
create_table :reviews do |t|
t.column :authentication_token
end
add_index :users, :authentication_token, :unique => true
end
def self.down
remove_index :users, :authentication_token
remove_column :users, :authentication_token
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.