Skip to content

Commit 2dac09c

Browse files
authored
Closes #20341: Drop legacy django_admin_log table (#20349)
1 parent 2a99aad commit 2dac09c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from django.db import migrations
2+
3+
4+
class Migration(migrations.Migration):
5+
dependencies = [
6+
('users', '0011_concrete_objecttype'),
7+
]
8+
9+
operations = [
10+
# Django admin UI was removed in NetBox v4.0
11+
# Older installations may still have the old `django_admin_log` table in place
12+
# Drop the obsolete table if it exists. This is a no-op on fresh or already-clean DBs.
13+
migrations.RunSQL(
14+
sql='DROP TABLE IF EXISTS "django_admin_log";',
15+
reverse_sql=migrations.RunSQL.noop,
16+
),
17+
# Clean up a potential leftover sequence in older DBs
18+
migrations.RunSQL(
19+
sql='DROP SEQUENCE IF EXISTS "django_admin_log_id_seq";',
20+
reverse_sql=migrations.RunSQL.noop,
21+
),
22+
]

0 commit comments

Comments
 (0)