From f72591195e91fc57a9cd00a55f6f4946d2cf64d0 Mon Sep 17 00:00:00 2001 From: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> Date: Mon, 20 Oct 2025 08:50:23 -0400 Subject: [PATCH] Fix migration failure for 0200 (#16135) Moved the AddField operation before the RunPython operations for 'rename_jts' and 'rename_projects' in migration 0200_template_name_constraint.py. This ensures the new 'org_unique' field exists before related data migrations are executed. Fix ``` django.db.utils.ProgrammingError: column main_unifiedjobtemplate.org_unique does not exist ``` while applying migration 0200_template_name_constraint.py when there's a job template or poject with duplicate name in the same org --- awx/main/migrations/0200_template_name_constraint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/migrations/0200_template_name_constraint.py b/awx/main/migrations/0200_template_name_constraint.py index 5627a91728..08239cad48 100644 --- a/awx/main/migrations/0200_template_name_constraint.py +++ b/awx/main/migrations/0200_template_name_constraint.py @@ -38,13 +38,13 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython(rename_jts, migrations.RunPython.noop), - migrations.RunPython(rename_projects, migrations.RunPython.noop), migrations.AddField( model_name='unifiedjobtemplate', name='org_unique', field=models.BooleanField(blank=True, default=True, editable=False, help_text='Used internally to selectively enforce database constraint on name'), ), + migrations.RunPython(rename_jts, migrations.RunPython.noop), + migrations.RunPython(rename_projects, migrations.RunPython.noop), migrations.RunPython(rename_wfjt, migrations.RunPython.noop), migrations.RunPython(change_inventory_source_org_unique, migrations.RunPython.noop), migrations.AddConstraint(