Skip to content

Commit d36a868

Browse files
intgrauvipy
authored andcommitted
Work around Oracle migration instability
Fixes #222. Django's auto-generated index names are not stable across database engines: https://code.djangoproject.com/ticket/33483 Added explicit index names to `models.py` to work around that, until a fix is implemented in Django itself.
1 parent fb96094 commit d36a868

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

django_celery_results/models.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,18 @@ class Meta:
9595
verbose_name = _('task result')
9696
verbose_name_plural = _('task results')
9797

98+
# Explicit names to solve https://code.djangoproject.com/ticket/33483
9899
indexes = [
99-
models.Index(fields=['task_name']),
100-
models.Index(fields=['status']),
101-
models.Index(fields=['worker']),
102-
models.Index(fields=['date_created']),
103-
models.Index(fields=['date_done']),
100+
models.Index(fields=['task_name'],
101+
name='django_cele_task_na_08aec9_idx'),
102+
models.Index(fields=['status'],
103+
name='django_cele_status_9b6201_idx'),
104+
models.Index(fields=['worker'],
105+
name='django_cele_worker_d54dd8_idx'),
106+
models.Index(fields=['date_created'],
107+
name='django_cele_date_cr_f04a50_idx'),
108+
models.Index(fields=['date_done'],
109+
name='django_cele_date_do_f59aad_idx'),
104110
]
105111

106112
def as_dict(self):
@@ -221,7 +227,10 @@ class Meta:
221227
verbose_name = _('group result')
222228
verbose_name_plural = _('group results')
223229

230+
# Explicit names to solve https://code.djangoproject.com/ticket/33483
224231
indexes = [
225-
models.Index(fields=['date_created']),
226-
models.Index(fields=['date_done']),
232+
models.Index(fields=['date_created'],
233+
name='django_cele_date_cr_bd6c1d_idx'),
234+
models.Index(fields=['date_done'],
235+
name='django_cele_date_do_caae0e_idx'),
227236
]

0 commit comments

Comments
 (0)