Gitlab-ce 15.0.5-ce.0 to gitlab-ce=15.4.6-ce.0 upgrade db migration problem

Hello,

I’m trying to upgrade to the latest version of gitlab-ce, however I’m having a db migration problem. Here’s the shortened version of gitlab-rake db:migrate --trace output,

** Execute db:migrate
main: == 20220902204048 MoveSecurityFindingsTableToGitlabPartitionsDynamicSchema: migrating 
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("LOCK TABLE vulnerability_scanners, security_scans, security_findings IN ACCESS EXCLUSIVE MODE\n")
main:    -> 0.0009s
main: -- execute("SELECT\n  pg_get_constraintdef(pg_catalog.pg_constraint.oid)\nFROM\n  pg_catalog.pg_constraint\nINNER JOIN pg_class ON pg_class.oid = pg_catalog.pg_constraint.conrelid\nWHERE\n  conname = 'check_partition_number' AND\n  pg_class.relname = 'security_findings'\n")
main:    -> 0.0157s
main: -- execute("ALTER TABLE security_findings RENAME TO security_findings_1;\n")
main:    -> 0.0013s
main: -- execute("ALTER INDEX security_findings_pkey RENAME TO security_findings_1_pkey;\n")
main:    -> 0.0023s
main: -- execute("CREATE TABLE security_findings (\n  LIKE security_findings_1 INCLUDING ALL\n) PARTITION BY LIST (partition_number);\n")
main:    -> 0.0050s
main: -- execute("ALTER SEQUENCE security_findings_id_seq OWNED BY public.security_findings.id;\n")
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

PG::ObjectNotInPrerequisiteState: ERROR:  sequence must have same owner as table it is linked to
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `block (2 levels) in execute'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'

....

Caused by:
ActiveRecord::StatementInvalid: PG::ObjectNotInPrerequisiteState: ERROR:  sequence must have same owner as table it is linked to
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'

....

Caused by:
PG::ObjectNotInPrerequisiteState: ERROR:  sequence must have same owner as table it is linked to
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:49:in `exec'

...

/opt/gitlab/embedded/bin/rake:23:in `load'
/opt/gitlab/embedded/bin/rake:23:in `<top (required)>'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `load'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `kernel_load'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:23:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli.rb:483:in `exec'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli.rb:31:in `dispatch'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/cli.rb:25:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/exe/bundle:48:in `block in <top (required)>'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/exe/bundle:36:in `<top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate

this VM is running on google cloud and the database is a cloud sql pgsql13. OS is debian 10.13

Can someone please help?
Thanks