Devise migration on existing model

后端 未结 4 1282
北海茫月
北海茫月 2020-12-08 17:47

I\'m migrating from Authlogic to Devise.

UPDATED:

The migration of devise tries to re-create the table users, so i changed as you can see below the create_

4条回答
  •  自闭症患者
    2020-12-08 18:25

    add_column(:users, :database_authenticatable, {:null=>false})
    

    You are not providing information for how this field is to be setup. It needs to be a string I think so you want to pass that information.

    add_column :users, :database_authenticatable, :string,  :null=>false
    

    More information about the error you are getting:

    undefined method `to_sym'
    

    That error for migrations is really frustrating because it lacks content, but what it means is that you got your migration in the wrong order.

    For example - if you add a boolean file to the use model:

     add_column :users, :user_is_a_jackass, :boolean, :default => false
    

    That will migrate ok. But if you do it like this:

    add_column :users, :user_is_a_jackass, :default => false
    

    You will get the same error because you are not telling the migration what field type it should be.

提交回复
热议问题