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_table to change_table and drop table at the end to remove what i add
The problem is when I run rake i get an error .
This is the error I get when running rake.
== DeviseCreateUsers: migrating ==============================================
-- change_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL
This is the migration
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
end
def self.down
remove_column :users, :database_authenticatable
remove_column :users, :recoverable
remove_column :users, :rememberable
remove_column :users, :trackable
remove_index :users, :email
remove_index :users, :reset_password_token
end
end
In my schema.rb i already have this from Authlogic.
create_table "users", :force => true do |t|
t.string "username"
t.string "email"
t.string "crypted_password"
t.string "password_salt"
t.string "persistence_token"
I think it sees some kind of conflict that i’m not able to realize how to avoid with those devise helpers
Thank you!
The error that you’re getting is because you are trying to recreate the
emailfield which you already have. Theemailfield is created in the devise helpert.database_authenticatable. You can use your old user table with the new system, but you don’t need to includet.database_authenticatable, you just need to rename your old field names. Looking in the Documentation for Devise, you can see thatdatabase_authenticatablejust creates three fields: email, encrypted_password and password_salt. They are the same as the email, crypted_password, and password_salt that you already have in your authlogic user table, so you can use change_table like so: