AAP-87599 — Re-parent 0206 and add 0209 merge migration for 2.6 backport (#16612)

* AAP-87599 — Re-parent 0206 and update 0207 as merge point for 2.6 backport

Re-parent 0206_jobhostsummary_host_id_idx to depend on 0203 instead
of 0205, and add 0205 as a second dependency on 0207 to converge the
migration graph.

This follows the gateway backport migration pattern (AAP-80663) so that
the same 0206 migration file can be backported to stable-2.6 (where
0204/0205 do not exist) without breaking upgrade paths.

* AAP-87599 — Move merge point to 0209, restore 0207 to original

Reverts the 0205 dependency addition on 0207_alter_skip_tags and
instead adds 0209_merge_0205_0206 at the end of the chain. This
keeps 0207 pristine so it can be backported to stable-2.7 in the
future without a naming conflict.

Migration graph after this change:

  0203 → 0204 → 0205 ──────────────────────────────────┐
    \                                                    ↓
     → 0206 → 0207_skip_tags → 0208_sys_auditor → 0209_merge

* AAP-87599 — Move merge point to 0207 for devel/2.7 parity

Restructure the migration graph so devel matches stable-2.7 through
the merge point:

- 0207_merge_0205_0206 is now identical on both branches (depends on
  0205 + 0206, empty operations)
- Renumber 0207_alter_skip_tags → 0208, 0208_fix_system_auditor → 0209
- Both depend linearly from the merge point forward

Graph:
  0205 ──────────────┐
    \                 ↓
     0206 → 0207_merge → 0208_skip_tags → 0209_sys_auditor

* Fix test references after migration rename 0208→0209

Update test_migrations.py to reference 0209_fix_system_auditor_migration
after the merge point restructure moved it from 0208 to 0209.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Peter Braun <pbraun@redhat.com>
This commit is contained in:
Dirk Julich
2026-08-25 18:19:07 +02:00
committed by GitHub
co-authored by Claude Opus 4.6 Peter Braun
parent 7765376450
commit d1fdad7718
5 changed files with 17 additions and 7 deletions
@@ -3,7 +3,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0205_add_ordering_to_instancegroup_and_workflow_nodes'),
('main', '0203_remove_team_of_teams'),
]
operations = [
@@ -0,0 +1,10 @@
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0205_add_ordering_to_instancegroup_and_workflow_nodes'),
('main', '0206_jobhostsummary_host_id_idx'),
]
operations = []
@@ -5,7 +5,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0206_jobhostsummary_host_id_idx'),
('main', '0207_merge_0205_0206'),
]
operations = [
@@ -37,7 +37,7 @@ def fix_system_auditor_assignments(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
('main', '0207_alter_skip_tags_to_textfield'),
('main', '0208_alter_skip_tags_to_textfield'),
]
operations = [
+4 -4
View File
@@ -251,7 +251,7 @@ class TestSystemAuditorMigration:
def test_fix_system_auditor_migration_backfills_missing(self, migrator):
"""
Migration 0208 should backfill Platform Auditor for any
Migration 0209 should backfill Platform Auditor for any
system_auditor members who were missed by the original migration.
"""
state = migrator.apply_initial_migration(('main', '0190_alter_inventorysource_source_and_more'))
@@ -273,7 +273,7 @@ class TestSystemAuditorMigration:
"Setup: user should not have Platform Auditor before corrective migration"
)
state = migrator.apply_tested_migration(('main', '0208_fix_system_auditor_migration'))
state = migrator.apply_tested_migration(('main', '0209_fix_system_auditor_migration'))
RoleUserAssignment = state.apps.get_model('dab_rbac', 'RoleUserAssignment')
assert RoleUserAssignment.objects.filter(user=user.id, role_definition__name='Platform Auditor').exists(), (
@@ -282,7 +282,7 @@ class TestSystemAuditorMigration:
def test_fix_system_auditor_migration_no_duplicates(self, migrator):
"""
Migration 0208 must be idempotent — users who already have
Migration 0209 must be idempotent — users who already have
Platform Auditor should not receive a duplicate assignment.
"""
state = migrator.apply_initial_migration(('main', '0190_alter_inventorysource_source_and_more'))
@@ -299,7 +299,7 @@ class TestSystemAuditorMigration:
# Confirm the user already has the assignment (from the fixed 0192)
assert RoleUserAssignment.objects.filter(user=user.id, role_definition__name='Platform Auditor').exists()
state = migrator.apply_tested_migration(('main', '0208_fix_system_auditor_migration'))
state = migrator.apply_tested_migration(('main', '0209_fix_system_auditor_migration'))
RoleUserAssignment = state.apps.get_model('dab_rbac', 'RoleUserAssignment')
assert RoleUserAssignment.objects.filter(user=user.id, role_definition__name='Platform Auditor').count() == 1, (