Properly enhance multi-db partitioning rake tasks
What does this MR do and why?
Related to #352770 (closed)
With the addition of multiple databases, many of the rake tasks now have variants for each database, like:
rails db:migrate
rails db:migrate:main
rails db:migrate:ci
This MR fixes existing use of enhance
to create dynamic partitions on all variants of these tasks.
How to set up and validate locally
- Setup multiple databases according https://docs.gitlab.com/ee/development/database/multiple_databases.html#development-setup
- Drop the existing database (or you can configure a new one if you need data in yours, as long as the schema is not loaded)
rails db:drop && rails db:create
- Load the schema in the
main
database only:rails db:structure:load:main
rails db:schema:load:main
- Look for partitions on a partitioned table, like
audit_events
. On master the partitions will not exist, but on this branch they will:-- master \d audit_events ... Number of partitions: 0 -- this branch \d audit_events ... Number of partitions: 8
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Patrick Bair