Project push rules: Migrate project push rules to dedicated table
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Implementation plan
We want to use the push_rules table as a dedicated table for projects. Therefore, we should remove push_rules records belonging to a group or organization.
- Create a migration to destroy
push_rulesrecords whereorganization_idis populated. - Create a migration to destroy
push_rulesrecords associated with a group (wherepush_rule_idis not null).
Expectations
- Follow this guideline for data migrations https://docs.gitlab.com/development/database_review/#preparation-when-adding-data-migrations
- Cover the migrations result with specs.
- Collaborate with the database team to get a review.
Next Steps
- Create a new table migration project_push_rules (w1)
- Add triggers to copy data from push_rules to project_push_rules similar to what we have for organization_push_rules and group_push_rules (w2)
-
Write a BBM to copy historical data from push_rules to project_push_rules (w2)
- Account for duplicates logic in BBM: !199307 (closed)
- migrate missing records: !219705 (merged) (18.9)
Implementation Plan
| Step | Milestone | Weight | Done? |
|---|---|---|---|
| Create project_push_rules table | 18.6 |
|
|
| Sync project_push_rules on push_rules write operations | 18.6 |
|
|
| BBM to copy push_rules data to project_push_rules | 18.7 | 2 |
|
| Migrate duplicate push_rules to project_push_rules | 18.7 |
|
|
BackfillMissingProjectPushRules migration |
18.9 | 2 |
|
| Reset project_push_rules id sequence to prevent UniqueViolation errors | 18.10 | 2 |
MR |
| Write switch code (FF off) | 18.10 | 3 | Implementation plan |
| Enable FF on GitLab.com | 18.10 | 1 | |
| Finalize BBM | 18.11 (a required stop) | 1 | |
| Enable FF for self-managed | 19.0 | 1 | |
| Cleanup the read_project_push_rules, and write_project_push_rules feature flags | 19.1 | 1 | |
| Remove unused project_settings.push_rule_id column | 19.1 | 2 | |
| Remove project push rules sync triggers after table migration | 19.1 | 1 | |
| Move push rule models under PushRules:: namespace | 19.1 | 2 | |
| Drop the push_rules table | 19.2 | 1 |
Edited by Emma Park