1 # -*- coding: utf-8 -*-
4 from django
.db
import migrations
7 def forward(apps
, schema_editor
):
9 # This index can apparently not be created on sqlite
10 # As it is not recommended for production use, we can just
11 # skip the index there
12 if schema_editor
.connection
.vendor
== 'sqlite':
17 ('CREATE INDEX episodes_podcast_hasreleased '
18 'ON podcasts_episode '
19 '(podcast_id, (released IS NOT NULL) DESC, released DESC);',
25 def reverse(apps
, schema_editor
):
27 ('DROP INDEX IF EXISTS episodes_podcast_hasreleased;', None)
31 class Migration(migrations
.Migration
):
34 ('podcasts', '0023_auto_20140729_1711'),
38 # Wrap RunSQL in RunPython to check for DB backend
39 # http://stackoverflow.com/a/37521148/693140