ruby-on-rails – 如何判断rake db:migrate和rake db:seed是否
发布时间:2020-12-17 02:39:27 所属栏目:百科 来源:网络整理
导读: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
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 我认为这意味着它是成功的(我没有看到任何中止)? 然后当我运行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 (插件加载没有错误)然后: ** Execute db:abort_if_pending_migrations 这是否意味着迁移和种子正常工作? 解决方法
如果它没有中止,它就成功了.拿一个
look at the code:
# 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 如果没有任何挂起的迁移,它实际上什么都不做. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |