Content
You are here:
FAILED: upgrade from OP8 to OP12 with docker script migrate-from-pre-8.sh
Added by Rohit Patil over 1 year ago
I am trying to migrate from OP8 to OP12.
I am using the docker script provided here https://github.com/opf/openproject/blob/dev/script/migration/migrate-from-pre-8.sh
the DB export from mysql and import into postgres-13 succeeds, as seen in below output
2023-07-30T20:31:37.523436Z LOG report summary reset
table name errors read imported bytes total time read write
-------------------------------------------- --------- --------- --------- --------- -------------- --------- ---------
fetch meta data 0 368 368 0.070s
Create Schemas 0 0 0 0.002s
Create SQL Types 0 0 0 0.001s
Create tables 0 202 202 0.306s
Set Table OIDs 0 101 101 0.003s
-------------------------------------------- --------- --------- --------- --------- -------------- --------- ---------
But facing below errors,when susequent mgration scripts are ruuning.
PG::NotNullViolation: ERROR: null value in column "id" of relation "role_permissions" violates not-null constraint
DETAIL: Failing row contains (null, show_board_views, 1, 2023-07-30 19:03:18.910784+00, 2023-07-30 19:03:18.910784+00).
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `async_exec_params'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `block (2 levels) in exec_no_cache'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `block in exec_no_cache'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:718:in `block (2 levels) in log'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:717:in `block in log'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:708:in `log'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:670:in `exec_no_cache'
.....
.....
.....
/app/app/models/role.rb:200:in `add_permission'
/app/app/models/role.rb:89:in `block in add_permission!'
/app/app/models/role.rb:88:in `each'
/app/app/models/role.rb:88:in `add_permission!'
/app/db/migrate/migration_utils/permission_adder.rb:40:in `block in add'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:70:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:70:in `block in find_each'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:238:in `block in in_batches'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:222:in `loop'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:222:in `in_batches'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:135:in `find_in_batches'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/batches.rb:69:in `find_each'
/app/db/migrate/migration_utils/permission_adder.rb:38:in `add'
/app/db/migrate/20190507132517_add_board_view_to_roles.rb:6:in `up'
....
....
PG::NotNullViolation: ERROR: null value in column "id" of relation "relations" violates not-null constraint
DETAIL: Failing row contains (null, 2, 2, null, null, 0, 0, 0, 0, 0, 0, 0, 1).
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `async_exec'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `block (2 levels) in execute'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
...
....
/app/vendor/bundle/ruby/2.6.0/gems/typed_dag-2.0.2/lib/typed_dag/rebuild_dag.rb:72:in `insert_transitive_relations'
/app/vendor/bundle/ruby/2.6.0/gems/typed_dag-2.0.2/lib/typed_dag/rebuild_dag.rb:26:in `truncate_and_rebuild'
/app/vendor/bundle/ruby/2.6.0/gems/typed_dag-2.0.2/lib/typed_dag/rebuild_dag.rb:12:in `rebuild_dag!'
/app/db/migrate/20180105130053_rebuild_dag.rb:51:in `block in up'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/migration.rb:858:in `block in say_with_time'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/migration.rb:858:in `say_with_time'
/app/db/migrate/20180105130053_rebuild_dag.rb:50:in `up'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/migration.rb:831:in `exec_migration'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/migration.rb:811:in `block in migrate'
...
...
Tasks: TOP => db:migrate:up
(See full trace by running task with --trace)
Rebuild DAG migration failed. See above.
Looks like the id column "default" value is NOT set to auto_increment; but the migration script is trying to insert a null value for 'id', assuming the postgres db would add a auto-incremented value for id But looks like its is not; and giving the above error.
Could anyone please provide and pointers on how i can porceed with the upgrade.