Я перехожу из Authlogic в Devise.Утилита миграции на существующую модель
ОБНОВЛЕНО:
Миграция завещанию пытается воссоздать пользователей таблицы, так что я изменился, как вы можете увидеть ниже create_table в change_table и удалить таблицу в конце, чтобы удалить то, что я добавить
Проблема в том, что когда я запускаю 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
Это миграция
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
В моей schema.rb я уже это от 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"
Я думаю, что он видит какой-то конфликт, что я не в состоянии понять, как избежать с теми, разработать хелперы
Спасибо!
Пожалуйста, отметьте ответ jamuraa правильно. В противном случае этот вопрос появляется в «списке без ответа». – kikito