Skip to content

Commit

Permalink
Remove index related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
milind-shakya-sp committed Dec 3, 2018
1 parent 4eea347 commit 0da676f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
12 changes: 0 additions & 12 deletions django_celery_beat/migrations/0002_auto_20161118_0346.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from django.db import migrations, models
import django.db.models.deletion
import django_celery_beat.models


class Migration(migrations.Migration):
Expand Down Expand Up @@ -51,14 +50,3 @@ class Migration(migrations.Migration):
to='django_celery_beat.SolarSchedule', verbose_name='solar'),
),
]
custom_operations = [
migrations.AddIndex(
model_name='periodictask',
index=django_celery_beat.models.CeleryMySQLIndex(
fields=['name'],
name='django_cele_name_9c39ec_idx'
)
)
]

operations = operations + custom_operations
19 changes: 0 additions & 19 deletions django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from django.core.validators import MaxValueValidator
from django.db import models
from django.db.models import signals
from django.db.models.indexes import Index
from django.utils.translation import ugettext_lazy as _

from . import managers, validators
Expand Down Expand Up @@ -41,23 +40,6 @@ def cronexp(field):
return field and str(field).replace(' ', '') or '*'


class CeleryMySQLIndex(Index):
def create_sql(self, model, schema_editor, using=''):
sql_create_index = 'CREATE INDEX %(name)s ON %(table)s (%(columns)s(%(size)d))%(extra)s'
sql_parameters = self.get_sql_create_template_values(
model,
schema_editor,
using
)
sql_parameters['size'] = getattr(
settings,
'DJANGO_CELERY_BEAT_NAME_MAX_LENGTH',
200
)
sql = sql_create_index % sql_parameters
return sql


@python_2_unicode_compatible
class SolarSchedule(models.Model):
"""Schedule following astronomical patterns."""
Expand Down Expand Up @@ -341,7 +323,6 @@ class Meta:

verbose_name = _('periodic task')
verbose_name_plural = _('periodic tasks')
indexes = [CeleryMySQLIndex(fields=['name'])]

def validate_unique(self, *args, **kwargs):
super(PeriodicTask, self).validate_unique(*args, **kwargs)
Expand Down

0 comments on commit 0da676f

Please sign in to comment.