rsm*_*ets 4 ruby schema ruby-on-rails seed dbmigrate
Ruby rake db:由于**Execute db:abort_if_pending_migrations导致种子中止,但我认为所有迁移都是成功的.
这是我运行rake db:migrate --trace时输出的最后一部分
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
Run Code Online (Sandbox Code Playgroud)
我认为这意味着它是成功的(我没有看到任何中止)?
然后当我运行rake db:seed --trace时我得到(总结):
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
loading plugins
Run Code Online (Sandbox Code Playgroud)
(插件加载没有错误)然后:
** Execute db:abort_if_pending_migrations
Run Code Online (Sandbox Code Playgroud)
这是否意味着迁移和种子正常工作?感谢您的时间和投入!
如果它没有中止,它就成功了.快来看看代码:
# desc "Raises an error if there are pending migrations"
task :abort_if_pending_migrations => :environment do
pending_migrations = ActiveRecord::Migrator.open(ActiveRecord::Migrator.migrations_paths).pending_migrations
if pending_migrations.any?
puts "You have #{pending_migrations.size} pending #{pending_migrations.size > 1 ? 'migrations:' : 'migration:'}"
pending_migrations.each do |pending_migration|
puts ' %4d %s' % [pending_migration.version, pending_migration.name]
end
abort %{Run `rake db:migrate` to update your database then try again.}
end
end
Run Code Online (Sandbox Code Playgroud)
如果没有任何挂起的迁移,它实际上什么都不做.
| 归档时间: |
|
| 查看次数: |
2088 次 |
| 最近记录: |