Skip to content

Commit

Permalink
Work around Oracle migration instability
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
intgr authored and auvipy committed Feb 9, 2022
1 parent fb96094 commit d36a868
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions django_celery_results/models.py
Expand Up @@ -95,12 +95,18 @@ class Meta:
verbose_name = _('task result')
verbose_name_plural = _('task results')

# Explicit names to solve https://code.djangoproject.com/ticket/33483
indexes = [
models.Index(fields=['task_name']),
models.Index(fields=['status']),
models.Index(fields=['worker']),
models.Index(fields=['date_created']),
models.Index(fields=['date_done']),
models.Index(fields=['task_name'],
name='django_cele_task_na_08aec9_idx'),
models.Index(fields=['status'],
name='django_cele_status_9b6201_idx'),
models.Index(fields=['worker'],
name='django_cele_worker_d54dd8_idx'),
models.Index(fields=['date_created'],
name='django_cele_date_cr_f04a50_idx'),
models.Index(fields=['date_done'],
name='django_cele_date_do_f59aad_idx'),
]

def as_dict(self):
Expand Down Expand Up @@ -221,7 +227,10 @@ class Meta:
verbose_name = _('group result')
verbose_name_plural = _('group results')

# Explicit names to solve https://code.djangoproject.com/ticket/33483
indexes = [
models.Index(fields=['date_created']),
models.Index(fields=['date_done']),
models.Index(fields=['date_created'],
name='django_cele_date_cr_bd6c1d_idx'),
models.Index(fields=['date_done'],
name='django_cele_date_do_caae0e_idx'),
]

1 comment on commit d36a868

@auvipy
Copy link
Member

@auvipy auvipy commented on d36a868 Jun 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.