Self-Managed Database Schema Issues
This epic is used to track database schema issues and, if a issue isn't raised separately, customer tickets. ## categories of issue ### views - https://gitlab.com/gitlab-org/gitlab/-/issues/292240 fixed with: ``` DROP VIEW public.postgres_indexes; ``` ### schemas - https://gitlab.com/gitlab-org/gitlab/-/issues/322619 had a backup/duplicate GitLab schema in the database ### primary keys - https://gitlab.com/gitlab-org/gitlab/-/issues/332612 13.5 migration to ensure tables have primary key encountered an old optional migration which ensured tables have primary keys, plus some other schema discrepancies. - https://gitlab.com/gitlab-org/gitlab/-/issues/341822 common 14.3 migration failure `cannot drop constraint ci_builds_pkey on table ci_builds` ### column types - with/without timezone type `timestamp with time zone` vs type `timestamp without time zone` See also: https://gitlab.com/groups/gitlab-org/-/epics/2473 - https://gitlab.com/gitlab-org/gitlab/-/issues/339091 - table `members`: `created_at` ``` PG::InvalidObjectDefinition: ERROR: functions in index predicate must be marked IMMUTABLE ``` ### data - https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5671 partitioning by date couldn't handle record dated ~600 years in future - `MigrateMergeRequestDiffCommitUsers` is a background migration from a release prior to %"14.5". During the >= %14.5 upgrade, this will get completed synchronously if needed, and can take hours. See https://gitlab.com/gitlab-org/gitlab/-/issues/334394#note_743124167 plus the rest of the issue for more detail. Contributing factors: Sidekiq stability issues that prevented the background migration completing prior to %"14.5". Detectable when checking for `pending` migrations as well as `running` ones - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75388 ### zero downtime upgrades of >1 releases - https://gitlab.com/gitlab-org/gitlab/-/issues/323113 `audit_events` - https://gitlab.com/gitlab-org/gitlab/-/issues/335026 `web_hook_logs` - https://gitlab.com/gitlab-org/gitlab/-/issues/340912 `web_hook_logs` - probably caused by zero downtime upgrades, given what we learned in https://gitlab.com/gitlab-org/gitlab/-/issues/335026 - already on 14.0, so archive table had gone. Added constraint from `20210413130011` and edited the migrations `up`
epic