迁移不适用于Ruby On Rails

时间:2017-03-23 14:41:14

标签: ruby-on-rails

由于某种原因,我的Ruby on Rails应用程序告诉我它无法运行迁移。我不确定如何解决这个问题。我创建了一张没有任何信息的表格。然后,我尝试删除迁移文件及其创建的表。当我尝试运行迁移命令时,它给了我这个错误:

rails aborted!
Don't know how to build task 'db:migration' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.0/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.0/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
/home/ubuntu/workspace/saasapp/bin/rails:9:in `require'
/home/ubuntu/workspace/saasapp/bin/rails:9:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
/usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/home/ubuntu/workspace/saasapp/bin/spring:15:in `require'
/home/ubuntu/workspace/saasapp/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)

有人可以帮我解决这个问题。我需要删除现有的表,以便我可以创建正确的表。它不会填充我的模式文件。

这是我运行rake db:migrate

时得到的错误
rake db:migrate

== 20170322214259 CreateProfiles:迁移=================================== - change_table(:个人资料) 耙子流产了! StandardError:发生错误,此以及所有后续迁移都已取消:

SQLite3 :: SQLException:无法添加具有默认值NULL的NOT NULL列:ALTER TABLE&#34; profiles&#34; ADD&#34; created_at&#34; datetime NOT NULL /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in initialize' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in new&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in prepare' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in执行&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in block in execute' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:566:in阻止日志&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.0/lib/active_support/notifications/instrumenter.rb:21:in instrument' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:560:in log&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:1096:in add_timestamps&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:525:in timestamps' /home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:11:in阻止变化&#39 ; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:845:in阻止method_missing&#39 ; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in block in say_with_time' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in say_with_time&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:834:in method_missing' /home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:3:in更改&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:788:in exec_migration' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:772:in阻止(2级)迁移&#39 ; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:771:in block in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:770:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:950:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1211:in block in execute_migration_in_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in阻止ddl_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in block in transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:189:in within_new_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/transactions.rb:211:in transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in ddl_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1210:in execute_migration_in_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1183:in block in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in每个&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1133:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1005:in up' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:983:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/tasks/database_tasks.rb:161:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/railties/databases.rake:58:in阻止(2级)& #39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rake-12.0.0/exe/rake:27:in <top (required)>' /usr/local/rvm/gems/ruby-2.3.0@saasapp/bin/ruby_executable_hooks:15:in eval&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/bin/ruby_executable_hooks:15:in <main>' ActiveRecord::StatementInvalid: SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER TABLE "profiles" ADD "created_at" datetime NOT NULL /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in初始化&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in new' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in准备&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in execute' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in阻止执行&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:566:in block in log' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.0/lib/active_support/notifications/instrumenter.rb:21:in instrument&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:560:in log' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in执行&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:1096:in add_timestamps' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:525:in时间戳&#39; /home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:11:in block in change' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:845:in block in method_missing' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in阻止在say_with_time&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in say_with_time' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:834:in method_missing&#39; /home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:3:in change' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:788:in exec_migration&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:772:in block (2 levels) in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:771:in阻止迁移&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:770:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:950:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1211:in块中的execute_migration_in_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in block in ddl_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in阻止交易&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:189:in within_new_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/transactions.rb:211:in transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in ddl_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1210:in execute_migration_in_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1183:in阻止在migrate_without_lock&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in each' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in migrate_without_lock&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1133:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1005:in up&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:983:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/tasks/database_tasks.rb:161:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/railties/databases.rake:58:in block (2 levels) in <top (required)>' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rake-12.0.0/exe/rake:27:in&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/bin/ruby_executable_hooks:15:in eval' /usr/local/rvm/gems/ruby-2.3.0@saasapp/bin/ruby_executable_hooks:15:in&#39; SQLite3 :: SQLException:无法添加默认值为NULL的NOT NULL列 /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in initialize' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in new&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in prepare' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in执行&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in block in execute' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:566:in阻止日志&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.0/lib/active_support/notifications/instrumenter.rb:21:in instrument' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:560:in log&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:1096:in add_timestamps&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:525:in timestamps' /home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:11:in阻止变化&#39 ; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:845:in阻止method_missing&#39 ; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in block in say_with_time' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in say_with_time&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:834:in method_missing' /home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:3:in更改&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:788:in exec_migration' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:772:in阻止(2级)迁移&#39 ; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:771:in block in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:770:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:950:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1211:in block in execute_migration_in_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in阻止ddl_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in block in transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:189:in within_new_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/transactions.rb:211:in transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in ddl_transaction' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1210:in execute_migration_in_transaction&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1183:in block in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in每个&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1133:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1005:in up' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:983:in migrate&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/tasks/database_tasks.rb:161:in migrate' /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activerecord-5.0.0/lib/active_record/railties/databases.rake:58:in阻止(2级)& #39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rake-12.0.0/exe/rake:27:in <top (required)>' /usr/local/rvm/gems/ruby-2.3.0@saasapp/bin/ruby_executable_hooks:15:in eval&#39; /usr/local/rvm/gems/ruby-2.3.0@saasapp/bin/ruby_executable_hooks:15:in`&#39; 任务:TOP =&gt; DB:迁移 (通过使用--trace运行任务查看完整跟踪)

2 个答案:

答案 0 :(得分:0)

我相信您已使用迁移而非迁移 rake db:migrate

答案 1 :(得分:0)

除了我的评论,建议您使用rake db:migrate代替rake db:migration

如果您在生成模型/迁移时发现错误,我还建议您查看rake db:rollback