misc: cleanup remaining tables from django-admin-tools (#48614)
This commit is contained in:
parent
0153163669
commit
60c182181d
|
@ -0,0 +1,30 @@
|
|||
from django.db import migrations
|
||||
import logging
|
||||
|
||||
|
||||
def noop(apps, schema_editor):
|
||||
pass
|
||||
|
||||
|
||||
def clean_admin_tools_tables(apps, schema_editor):
|
||||
try:
|
||||
with schema_editor.connection.cursor() as cursor:
|
||||
cursor.execute("SELECT table_name FROM information_schema.tables "
|
||||
"WHERE table_schema = current_schema() "
|
||||
"AND table_name LIKE 'admin_tools%'")
|
||||
rows = cursor.fetchall()
|
||||
for table_name, in rows:
|
||||
cursor.execute('DROP TABLE "%s" CASCADE' % table_name)
|
||||
except Exception:
|
||||
logging.getLogger(__name__).exception('migration authentic2.0030 failed')
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2', '0029_auto_20201013_1614'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(clean_admin_tools_tables, noop),
|
||||
]
|
Loading…
Reference in New Issue