Project

General

Profile

QA #782

yaml_dbを使ったDBのマイグレーションで失敗する

Added by Tamura Shinji over 2 years ago. Updated over 2 years ago.

Status:
新規
Priority:
通常
Assignee:
-
Category:
-
Target version:
-
Start date:
03/26/2018
Due date:
% Done:

0%

Estimated time:

Description

環境は

Environment:
  Redmine version                3.4.4.stable.17197
  Ruby version                   2.4.3-p205 (2017-12-14) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production

で、MariaDB(10)からPostgresql(9.6)へデータ移行させようとしています。

RAILS_ENV=production bundle exec rake db:data:dump

でデータダンプしたのち、

RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:plugins:migrate
RAILS_ENV=production bundle exec rake tmp:cache:clear tmp:sessions:clear
RAILS_ENV=production bundle exec rake db:data:load

を実行すると。。。

 RAILS_ENV=production bundle exec rake db:data:load
rake aborted!
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
: DELETE FROM "projects" 
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:71:in `rescue in truncate_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:67:in `truncate_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:78:in `load_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:64:in `block (2 levels) in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `each'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `block in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:61:in `load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:63:in `block in load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:62:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:37:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/rake_tasks.rb:13:in `data_load_task'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/tasks/yaml_db_tasks.rake:21:in `block (3 levels) in <top (required)>'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

Caused by:
PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:71:in `rescue in truncate_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:67:in `truncate_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:78:in `load_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:64:in `block (2 levels) in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `each'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `block in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:61:in `load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:63:in `block in load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:62:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:37:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/rake_tasks.rb:13:in `data_load_task'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/tasks/yaml_db_tasks.rake:21:in `block (3 levels) in <top (required)>'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::FeatureNotSupported: ERROR:  cannot truncate a table referenced in a foreign key constraint
DETAIL:  Table "easy_settings" references "projects".
HINT:  Truncate table "easy_settings" at the same time, or use TRUNCATE ... CASCADE.
: TRUNCATE "projects" 
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:69:in `truncate_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:78:in `load_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:64:in `block (2 levels) in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `each'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `block in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:61:in `load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:63:in `block in load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:62:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:37:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/rake_tasks.rb:13:in `data_load_task'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/tasks/yaml_db_tasks.rake:21:in `block (3 levels) in <top (required)>'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

Caused by:
PG::FeatureNotSupported: ERROR:  cannot truncate a table referenced in a foreign key constraint
DETAIL:  Table "easy_settings" references "projects".
HINT:  Truncate table "easy_settings" at the same time, or use TRUNCATE ... CASCADE.
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:69:in `truncate_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:78:in `load_table'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:64:in `block (2 levels) in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `each'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:62:in `block in load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db.rb:61:in `load_documents'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:63:in `block in load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:62:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/serialization_helper.rb:37:in `load'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/yaml_db/rake_tasks.rb:13:in `data_load_task'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/yaml_db-0.6.0/lib/tasks/yaml_db_tasks.rake:21:in `block (3 levels) in <top (required)>'
/var/www/redmine/site/rtest/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:data:load
(See full trace by running task with --trace)

となってしまいます。。。

Postgresqlの9.6ではうまくいかないんでしょうか???
CentOS7の9.3ではまだ試していないです。。。

Also available in: Atom PDF