瀏覽代碼

Fixes #15605: Account for older sequence name in migration

Jeremy Stretch 2 年之前
父節點
當前提交
89453a49d6
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      netbox/extras/migrations/0111_rename_content_types.py

+ 5 - 1
netbox/extras/migrations/0111_rename_content_types.py

@@ -27,7 +27,11 @@ class Migration(migrations.Migration):
             field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.objecttype'),
         ),
         migrations.RunSQL(
-            "ALTER TABLE extras_customfield_content_types_id_seq RENAME TO extras_customfield_object_types_id_seq"
+            "ALTER TABLE IF EXISTS extras_customfield_content_types_id_seq RENAME TO extras_customfield_object_types_id_seq"
+        ),
+        # Pre-v2.10 sequence name (see #15605)
+        migrations.RunSQL(
+            "ALTER TABLE IF EXISTS extras_customfield_obj_type_id_seq RENAME TO extras_customfield_object_types_id_seq"
         ),
 
         # Custom links