设计SQLite3错误

时间:2015-04-06 22:13:42

标签: ruby sqlite devise

我正在将我的网站从自定义设置为设计(从未部署)。我想要做的是用一个设备替换我当前的sql数据库。当我迁移时,我收到此错误:

jakxna360@ubuntu:~/rails/AoO$ rake db:migrate
== 20150406212543 AddDeviseToUsers: migrating             =================================
    -- change_table(:users)
   rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD       "email" varchar DEFAULT '' NOT NULL/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-  1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:453:in `add_column'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:581:in `block (3 levels) in <class:Table>'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:580:i    n `each'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-   4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:580:i   n `block (2 levels) in <class:Table>'    /home/jakxna360/rails/AoO/db/migrate/20150406212543_add_devise_to_users.rb:6:in `block in up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-        4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.       2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.    2.1/lib/active_record/migration.rb:632:in `say_with_time'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:417:in `method_missing'
/home/jakxna360/rails/AoO/db/migrate/20150406212543_add_devise_to_users.rb:4:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:569:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:609:in `exec_migration'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in  `with_connection'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4  .2.1/lib/active_record/migration.rb:588:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email" varchar DEFAULT '' NOT NULL
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-  1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in  log'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:453:in `add_column'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:581:in `block (3 levels) in <class:Table>'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:580:in `each'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:580:in `block (2 levels) in <class:Table>'
/home/jakxna360/rails/AoO/db/migrate/20150406212543_add_devise_to_users.rb:6:in `block in up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:417:in `method_missing'
/home/jakxna360/rails/AoO/db/migrate/20150406212543_add_devise_to_users.rb:4:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:569:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:609:in `exec_migration'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
SQLite3::SQLException: duplicate column name: email
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `execute'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:453:in `add_column'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:581:in `block (3 levels) in <class:Table>'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:580:in `each'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:580:in `block (2 levels) in <class:Table>'
/home/jakxna360/rails/AoO/db/migrate/20150406212543_add_devise_to_users.rb:6:in `block in up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:417:in `method_missing'
/home/jakxna360/rails/AoO/db/migrate/20150406212543_add_devise_to_users.rb:4:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:569:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:609:in `exec_migration'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:1041:in `ddl_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/jakxna360/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Any help would be awesome!

1 个答案:

答案 0 :(得分:0)

您的模型似乎已经有了一个电子邮件列。我会编辑为您生成的迁移设备,并删除添加电子邮件列的行。