Explorar el Código

Closes #20341: Drop legacy django_admin_log table (#20349)

Martin Hauser hace 5 meses
padre
commit
2dac09cea0
Se han modificado 1 ficheros con 22 adiciones y 0 borrados
  1. 22 0
      netbox/users/migrations/0012_drop_django_admin_log_table.py

+ 22 - 0
netbox/users/migrations/0012_drop_django_admin_log_table.py

@@ -0,0 +1,22 @@
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('users', '0011_concrete_objecttype'),
+    ]
+
+    operations = [
+        # Django admin UI was removed in NetBox v4.0
+        # Older installations may still have the old `django_admin_log` table in place
+        # Drop the obsolete table if it exists. This is a no-op on fresh or already-clean DBs.
+        migrations.RunSQL(
+            sql='DROP TABLE IF EXISTS "django_admin_log";',
+            reverse_sql=migrations.RunSQL.noop,
+        ),
+        # Clean up a potential leftover sequence in older DBs
+        migrations.RunSQL(
+            sql='DROP SEQUENCE IF EXISTS "django_admin_log_id_seq";',
+            reverse_sql=migrations.RunSQL.noop,
+        ),
+    ]