Skip to content

Commit 0da676f

Browse files
Remove index related changes
1 parent 4eea347 commit 0da676f

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

django_celery_beat/migrations/0002_auto_20161118_0346.py

-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from django.db import migrations, models
66
import django.db.models.deletion
7-
import django_celery_beat.models
87

98

109
class Migration(migrations.Migration):
@@ -51,14 +50,3 @@ class Migration(migrations.Migration):
5150
to='django_celery_beat.SolarSchedule', verbose_name='solar'),
5251
),
5352
]
54-
custom_operations = [
55-
migrations.AddIndex(
56-
model_name='periodictask',
57-
index=django_celery_beat.models.CeleryMySQLIndex(
58-
fields=['name'],
59-
name='django_cele_name_9c39ec_idx'
60-
)
61-
)
62-
]
63-
64-
operations = operations + custom_operations

django_celery_beat/models.py

-19
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from django.core.validators import MaxValueValidator
1212
from django.db import models
1313
from django.db.models import signals
14-
from django.db.models.indexes import Index
1514
from django.utils.translation import ugettext_lazy as _
1615

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

4342

44-
class CeleryMySQLIndex(Index):
45-
def create_sql(self, model, schema_editor, using=''):
46-
sql_create_index = 'CREATE INDEX %(name)s ON %(table)s (%(columns)s(%(size)d))%(extra)s'
47-
sql_parameters = self.get_sql_create_template_values(
48-
model,
49-
schema_editor,
50-
using
51-
)
52-
sql_parameters['size'] = getattr(
53-
settings,
54-
'DJANGO_CELERY_BEAT_NAME_MAX_LENGTH',
55-
200
56-
)
57-
sql = sql_create_index % sql_parameters
58-
return sql
59-
60-
6143
@python_2_unicode_compatible
6244
class SolarSchedule(models.Model):
6345
"""Schedule following astronomical patterns."""
@@ -341,7 +323,6 @@ class Meta:
341323

342324
verbose_name = _('periodic task')
343325
verbose_name_plural = _('periodic tasks')
344-
indexes = [CeleryMySQLIndex(fields=['name'])]
345326

346327
def validate_unique(self, *args, **kwargs):
347328
super(PeriodicTask, self).validate_unique(*args, **kwargs)

0 commit comments

Comments
 (0)