Skip to content

Align the ordering of partitioned tables

Lin Jen-Shin requested to merge align-schema-ordering-for-jh into master

What does this MR do and why?

Align the ordering of verification_codes table for JiHu

In JiHu repository, there's an additional code to register this table to be synchronized like:

Gitlab::Database::Partitioning.register_models([
  Phone::VerificationCode
])

This does not present in GitLab repository, but only in JiHu repository, and this will cause the table to move to the top of db/structure.sql along with other synchronized partitioned tables. This happens when the following code runs:

Gitlab::Database::Partitioning.sync_partitions

We run this twice, once in config/initializers/postgres_partitioning.rb and once when we run rake db:migrate.

This will align both repositories to be more consistent.

The same does also happen for FOSS where incident_management_pending_alert_escalations and incident_management_pending_issue_escalations are not aligned.

How to set up and validate locally

Run this in both EE and JiHu to verify if it's changing db/structure.sql

bundle exec rake db:drop db:create db:structure:load db:migrate

This will validate for FOSS:

env FOSS_ONLY=1 bundle exec rake db:drop db:create db:structure:load db:migrate

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lin Jen-Shin

Merge request reports

Loading