mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 07:26:03 -03:30
detect event migration tables in a less noisy way
see: https://github.com/ansible/awx/issues/6493
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings # noqa
|
from django.conf import settings # noqa
|
||||||
from django.db import connection, ProgrammingError
|
from django.db import connection
|
||||||
from django.db.models.signals import pre_delete # noqa
|
from django.db.models.signals import pre_delete # noqa
|
||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
@@ -91,14 +91,13 @@ def enforce_bigint_pk_migration():
|
|||||||
'main_systemjobevent'
|
'main_systemjobevent'
|
||||||
):
|
):
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
try:
|
cursor.execute(
|
||||||
cursor.execute(f'SELECT MAX(id) FROM _old_{tblname}')
|
'SELECT 1 FROM information_schema.tables WHERE table_name=%s',
|
||||||
if cursor.fetchone():
|
(f'_old_{tblname}',)
|
||||||
from awx.main.tasks import migrate_legacy_event_data
|
)
|
||||||
migrate_legacy_event_data.apply_async([tblname])
|
if bool(cursor.rowcount):
|
||||||
except ProgrammingError:
|
from awx.main.tasks import migrate_legacy_event_data
|
||||||
# the table is gone (migration is unnecessary)
|
migrate_legacy_event_data.apply_async([tblname])
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup_created_modified_by(sender, **kwargs):
|
def cleanup_created_modified_by(sender, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user