Fix position of ai_events_counts and trial_usages in structure.sql

What does this MR do and why?

A follow-up to !254687 (merged). With Ai::EventsCount out of the partitioning initializer, a fresh schema load creates no partitions for ai_events_counts, and pg_dump then writes the table beside its sequence. db/structure.sql still has it in the earlier position, so db:check-migrations fails its rollback comparison on merge requests that add a migration. This regenerates db/structure.sql with scripts/regenerate-schema; the diff only moves the table block.

trial_usages is the reverse case. GitlabSubscriptions::TrialUsage is registered in that initializer, so db:schema:dump creates its partitions first and pg_dump writes the table among the partitioned tables, while db/structure.sql has it beside its sequence. This moves that table block too.

References

  • #628407 (phase 2 will drop the table)

How to set up and validate locally

  1. With an empty migration added, db:check-migrations fails on master and passes on this branch.

Claude Code wrote this change, and we ran the check above in a simulated environment on a test VM, against master at 35fef4e2, and again with both tables at 500f34d4.

In CI, db:check-migrations fails on exactly this move on a merge request that adds a migration: https://gitlab.com/gitlab-org/gitlab/-/jobs/16885759799. Since trial_usages landed, it fails on both moves: https://gitlab.com/gitlab-org/gitlab/-/jobs/16955431636. This branch adds no migration, so its own job skips schema validation.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Andrew Dunn

Merge request reports

Loading
Loading