Upgrade fails: 16.1.x -> 16.2.x (PG::UndefinedColumn: ERROR: column "id_convert_to_bigint" of relation "ci_build_needs" does not exist)
I tried to upgrade from gitlab-ee-16.1.1 to gitlab-ee-16.2.3 but that failed with a Postgres problem:
...
System Info:
------------
chef_version=17.10.0
platform=ubuntu
platform_version=20.04
ruby=ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/cinc-client
executable=/opt/gitlab/embedded/bin/cinc-client
...
Running handlers:
[2023-08-11T10:12:28+02:00] ERROR: Running exception handlers
There was an error running gitlab-ctl reconfigure:
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash_hide_env[migrate gitlab-rails database] (gitlab::database_migrations line 20) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash" ----
STDOUT: rake aborted!
StandardError: An error has occurred, all later migrations canceled:
PG::UndefinedColumn: ERROR: column "id_convert_to_bigint" of relation "ci_build_needs" does not exist
LINE 1: ...db_config_name:main*/ UPDATE "ci_build_needs" SET "id_conver...
...
Next, I tried to upgrade 16.1.1 -> 16.1.2 -> 16.1.3 -> 16.2.0 and the switch to 16.2 again failed with the same problem.