mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 23:41:23 -03:30
Register new column created by SQL
* .. using FakeAddField model type
* .. without doing this, Django won't know
about the field we created using raw SQL
This commit is contained in:
parent
d10d1963c1
commit
6ff15a928a
@ -63,6 +63,16 @@ def migrate_event_data(apps, schema_editor):
|
||||
cursor.execute(
|
||||
f'DROP TABLE {tblname}_old'
|
||||
)
|
||||
|
||||
|
||||
class FakeAddField(migrations.AddField):
|
||||
|
||||
def database_forwards(self, *args):
|
||||
# this is intentionally left blank, because we're
|
||||
# going to accomplish the migration with some custom raw SQL
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
@ -71,4 +81,9 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migrate_event_data),
|
||||
FakeAddField(
|
||||
model_name='jobevent',
|
||||
name='job_created',
|
||||
field=models.DateTimeField(editable=False),
|
||||
),
|
||||
]
|
||||
|
||||
@ -482,6 +482,9 @@ class JobEvent(BasePlaybookEvent):
|
||||
default='',
|
||||
editable=False,
|
||||
)
|
||||
job_created = models.DateTimeField(
|
||||
editable=False
|
||||
)
|
||||
|
||||
def get_absolute_url(self, request=None):
|
||||
return reverse('api:job_event_detail', kwargs={'pk': self.pk}, request=request)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user