Screwed up gitlab versions getting migration errors

For years i have been not taking the version serious and against all my believes kept using “latest” image tag for our self-hosted gitlab. I used to use pull new version whenever an “update now” message appeared.

Well this clumsy approach has finally came and bit me. Early last week something went wrong. I then obviously had no way of rolling back to the previous version, because i would not know (i could’ve, but worked too fast).

Last week i went back to an earlier version (most likely 14.3.5) and today someone complained about a 500 error. It turned out to be the following error

ERROR:  column "author_name" of relation "merge_request_diff_commits" does not exist
gitlab_1         | LINE 1: ...request_diff_commits ("message", "authored_date", "author_na..

I have been trying to go back to old versions and gradually move back to a more recent version.

  • Version 14.3.1 and 14.3.2 work* fine

  • Versions 14.3.2 to 14.3.3 work* but there’s an error in the logs:

    {"severity":"ERROR","time":"2021-12-06T13:02:21.166Z","correlation_id":null,"message":"Failed to create / detach partition(s)","table_name":"loose_foreign_keys_deleted_records","exception_class":{},"exception_message":"Unknown partition definition: FOR VALUES IN ('1')"}
    
  • Versions 14.4.0 to 14.4.3 fail and the container does not start. The error is

    cannot drop constraint fk_rails_fcbfd9338b on table gitlab_partitions_dynamic.incident_management_pending_alert_escalations_000000 because constraint fk_rails_fcbfd9338b on table incident_management_pending_alert_escalations requires it
    

*) When i say “work” i mean the container starts and the site becomes accessible. Most likely upon a merge request I would get the same error as describe above.

How can i go about and solve this problem.

Thanks for any help in this matter,

I have been able to update. i just dropped some constraints and indexes:

alter table incident_management_pending_alert_escalations drop constraint fk_rails_fcbfd9338b;
drop index index_incident_management_pending_alert_escalations_on_schedule;