qrurls/migrations/0011_auto__add_index_urlitem_published.py
author Tero Marttila <terom@fixme.fi>
Sat, 07 Sep 2013 16:00:13 +0300
changeset 85 adddd20cec75
parent 68 182ac4b328ec
permissions -rw-r--r--
fix DoesNotExist 404 for urlfeed
68
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
import datetime
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
from south.db import db
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
from south.v2 import SchemaMigration
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
from django.db import models
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
class Migration(SchemaMigration):
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
    def forwards(self, orm):
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
        # Adding index on 'URLItem', fields ['published']
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
        db.create_index(u'qrurls_urlitem', ['published'])
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
    def backwards(self, orm):
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
        # Removing index on 'URLItem', fields ['published']
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
        db.delete_index(u'qrurls_urlitem', ['published'])
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
    models = {
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
        u'qrurls.url': {
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
            'Meta': {'object_name': 'URL'},
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
            'publishing_days': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
            'publishing_time': ('django.db.models.fields.TimeField', [], {'default': 'datetime.time(0, 0)'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
            'shorturl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
        },
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
        u'qrurls.urlimage': {
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    30
            'Meta': {'ordering': "['uploaded']", 'object_name': 'URLImage'},
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    31
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
            'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    33
            'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
            'uploaded': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    36
        },
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    37
        u'qrurls.urlitem': {
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    38
            'Meta': {'ordering': "['published']", 'object_name': 'URLItem'},
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    39
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    40
            'image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['qrurls.URLImage']", 'null': 'True', 'blank': 'True'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    41
            'published': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    42
            'shorturl': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['qrurls.URL']"}),
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    43
            'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
        }
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
    }
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    46
182ac4b328ec add index on URLItem.published
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
    complete_apps = ['qrurls']