【发布时间】:2016-05-21 13:33:20
【问题描述】:
我正在使用 gem yaml_db 将我的 Postgres 开发数据库导出到生产环境,该数据库位于我的 Ruby on Rails 应用程序所在的虚拟机上。
我使用rake db:data:dump RAILS_ENV=development 创建data.yml 和rake db:data:load RAILS_ENV=production 导入数据,但我在导入时出错了。
rake aborted!
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
: DELETE FROM "improvement_actions"
PG::FeatureNotSupported: ERROR: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "comments" references "improvement_actions".
有谁知道如何解决这个问题?还是有其他方法可以导出我的数据库?
【问题讨论】: