Issues with migrating to 16.3.4

Hello out there,
im currently having a hard time migrating to 16.3.4 from a not to old gitlab version. At first i run into the issue described here: Batched Background migrations fail on upgrade to 15.11.0 (#408835) · Issues · GitLab.org / GitLab · GitLab
After applying this fix the missing entry was there but now complains that it already exists and cant continue with:
PG::DuplicateColumn: ERROR: column “id_convert_to_bigint” of relation “ci_build_needs” already exists
Any advice is well apreciated as i cannot get around this issue without getting the initial error.
Kind Regards Tobi

Hi Tobi,

We are also experiencing the same issue. We have tried the “fix” and get the “already exists” error.
PG::DuplicateColumn: ERROR: column “id_convert_to_bigint” of relation “ci_build_needs” already exists

Our DB is split as well and wonder if a migration to the wrong DB could cause this.

Hopefully someone will be able to enlighten us.

thanks,
Wayne

We were able to resolve this by dropping the “id_convert_to_bigint” column from ci_build_needs table and from the sent_notifications table. The reconfigure and subsequent upgrades were all successful.

upgrade order:
16.1.5 → 16.2.0 *reconfigure fails here and fix was applied then table exists problem occurred so dropped the 2 aforementioned columns and the reconfigure completes.
16.2.0–> 16.3.4 → 16.4.0.

good luck!

hello Waynus,
do you mind sharing the way you have done this? Tried exactly the same but it didnt work.
Kind Regards Tobias

Hi Tobias,

I ended up doing this since it was complaining they both existed.
gitlab-psql
ALTER TABLE ci_build_needs DROP COLUMN id_convert_to_bigint;
ALTER TABLE sent_notifications DROP COLUMN id_convert_to_bigint;
\q
gitlab-ctl reconfigure

Thanks will try it. Maybe i can contact you after that and report when it is successful or ran into an issue?
Kind Regard Tobi

we are also having trouble following the official migration path

16.1.5 → 16.2.8 shown here

We get this:

Caused by:
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...

I tried to get to 16.1.5 and alter the table as Waynus recommends above, but I got;

gitlabhq_production=# ALTER TABLE ci_build_needs DROP COLUMN id_convert_to_bigint;
ERROR:  column "id_convert_to_bigint" of relation "ci_build_needs" does not exist
gitlabhq_production=# ALTER TABLE sent_notifications DROP COLUMN id_convert_to_bigint;
ERROR:  column "id_convert_to_bigint" of relation "sent_notifications" does not exist

This is a bit annoying, since this failed upgrade actually prevents downgrading back to 16.1.5. So I need to pull the backup and start over if I want to test anything.

Thanks man, you saved me!
Upgrading from 15.11.13 to 16.1.6 then stuck at this issue.
Drop column does work, now DB migration works properly again!

If you have separated your database then be sure to run the truncate scripts afterwards.
https://docs.gitlab.com/ee/administration/postgresql/multiple_databases.html#cleaning-up

Not having run these 2 scripts were the main culprit behind my issues above.

Good Luck,
Waynus