执行 rake db:migrate 命令时,我不断收到以下错误:
耙中止!发生错误,此迁移和所有后续迁移已取消:SQLite3::SQLException:重复列名:电子邮件:ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL
我也试过命令 - bundle exec rake db:migrate。我跑了 --trace 并得到了信息。以下。
** 调用 db:migrate (first_time) ** 调用环境 (first_time) ** 执行环境 ** 调用 db:load_config (first_time) ** 执行 db:load_config ** 执行 db:migrate == AddDeviseToUsers: 迁移 ==== ============================================--change_table(:users)耙中止!发生错误,此迁移和所有后续迁移均已取消:
SQLite3::SQLException:重复列名:电子邮件:ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL /usr/local/rvm/gems/ruby-1.9.3-p392/gems/sqlite3- 1.3.7/lib/sqlite3/database.rb:91:在initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in
新的'/usr/local/rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/database.rb: 91:在prepare'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:134:in
执行中'/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:278 :block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_adapter.rb:280:in
在日志中的块'/usr/本地/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in log' /usr/local/rvm/gems/ruby-1.9 instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
。 3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapter/sqlite_adapter.rb:278:inexecute'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/schema_statements.rb:264:in
add_column' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:400:in add_column'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/schema_definitions.rb:479:in
block in string' /usr/local/rvm /gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/schema_definitions.rb:468:in each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/schema_definitions.rb:468:in
string' /Users/ddorrick/code/onrails/db/migrate/20130321170702_add_devise_to_users .rb:5:in block in up'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/schema_statements.rb:243:in
change_table' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:466:in block in method_missing'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:438:in
block in say_with_time' /usr /local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/benchmark.rb:280:in measure'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:438:in
say_with_time' /usr/local/rvm/gems/ruby-1.9.3-p392/gems /activerecord-3.2.12/lib/active_record/migration.rb:458:inmethod_missing'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:334:in
method_missing' /Users/ddorrick/code/onrails/db/migrate/20130321170702_add_devise_to_users.rb:3:in up'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:370:in
up' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib /active_record/migration.rb:410:in block (2 levels) in migrate'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/benchmark.rb:280:in
measure' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:410:in block in migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in
with_connection' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:389:in migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:528:in
migrate' /usr/local/rvm/gems/ruby-1.9 .3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:720:in block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:775:in
call' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12 /lib/active_record/migration.rb:775:inblock in ddl_transaction'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
事务' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/transactions.rb:208:intransaction'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:775:in
ddl_transaction' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:719:in block in migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:700:in
each' /usr/local/rvm/gems/ruby -1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:700:in migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/migration.rb:570:in
up' /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2 .12/lib/active_record/migration.rb:551:in migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:179:in
block (2 levels) in ' /usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/ rake/task.rb:228:incall'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/task.rb:228:in
块执行'/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/task.rb:223:在each'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/task.rb:223:in
执行'/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/task.rb:166:in block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:in
mon_synchronize'/usr/local/rvm/ gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/task.rb:159:ininvoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/task.rb:152:in
调用' /usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:143:in invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:101:in
block (2 levels) in top_level' /usr /local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:101:in each'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:101:in
block in top_level' /usr/local/rvm/gems/ruby -1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:110:in run_with_threads'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:95:in
top_level' /usr/local/rvm/gems/ruby-1.9.3-p392@global/gems /rake-10.0.3/lib/rake/application.rb:73:in block in run'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake/application.rb:160:in
standard_exception_handling' /usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/lib/rake /application.rb:70:in run'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.3/bin/rake:33:in
' /usr/local/rvm/gems/ruby-1.9.3-p392@global/bin/rake:19:in load'
/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin/rake:19:in
' /usr/local/rvm/gems/ruby-1.9.3 -p392/bin/ruby_noexec_wrapper:14:in eval'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in
' 任务:TOP => db:migrate