0001_initial.py 7.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Category'
        db.create_table(u'emissions_category', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=50)),
        ))
        db.send_create_signal(u'emissions', ['Category'])

        # Adding model 'Emission'
        db.create_table(u'emissions_emission', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)),
            ('description', self.gf('ckeditor.fields.RichTextField')(null=True, blank=True)),
            ('text', self.gf('ckeditor.fields.RichTextField')(null=True)),
            ('archived', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal(u'emissions', ['Emission'])

        # Adding M2M table for field categories on 'Emission'
        m2m_table_name = db.shorten_name(u'emissions_emission_categories')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('emission', models.ForeignKey(orm[u'emissions.emission'], null=False)),
            ('category', models.ForeignKey(orm[u'emissions.category'], null=False))
        ))
        db.create_unique(m2m_table_name, ['emission_id', 'category_id'])

        # Adding model 'Schedule'
        db.create_table(u'emissions_schedule', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('emission', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['emissions.Emission'])),
            ('datetime', self.gf('django.db.models.fields.DateTimeField')()),
            ('rerun', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal(u'emissions', ['Schedule'])

        # Adding model 'Episode'
        db.create_table(u'emissions_episode', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('emission', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['emissions.Emission'])),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)),
            ('description', self.gf('ckeditor.fields.RichTextField')(null=True, blank=True)),
            ('text', self.gf('ckeditor.fields.RichTextField')(null=True)),
        ))
        db.send_create_signal(u'emissions', ['Episode'])

        # Adding model 'Diffusion'
        db.create_table(u'emissions_diffusion', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('episode', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['emissions.Episode'])),
            ('datetime', self.gf('django.db.models.fields.DateTimeField')()),
        ))
        db.send_create_signal(u'emissions', ['Diffusion'])

        # Adding model 'SoundFile'
        db.create_table(u'emissions_soundfile', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('episode', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['emissions.Episode'])),
            ('file', self.gf('django.db.models.fields.files.FileField')(max_length=250)),
            ('podcastable', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('fragment', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=50)),
        ))
        db.send_create_signal(u'emissions', ['SoundFile'])


    def backwards(self, orm):
        # Deleting model 'Category'
        db.delete_table(u'emissions_category')

        # Deleting model 'Emission'
        db.delete_table(u'emissions_emission')

        # Removing M2M table for field categories on 'Emission'
        db.delete_table(db.shorten_name(u'emissions_emission_categories'))

        # Deleting model 'Schedule'
        db.delete_table(u'emissions_schedule')

        # Deleting model 'Episode'
        db.delete_table(u'emissions_episode')

        # Deleting model 'Diffusion'
        db.delete_table(u'emissions_diffusion')

        # Deleting model 'SoundFile'
        db.delete_table(u'emissions_soundfile')


    models = {
        u'emissions.category': {
            'Meta': {'object_name': 'Category'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'emissions.diffusion': {
            'Meta': {'object_name': 'Diffusion'},
            'datetime': ('django.db.models.fields.DateTimeField', [], {}),
            'episode': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['emissions.Episode']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        u'emissions.emission': {
            'Meta': {'object_name': 'Emission'},
            'archived': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['emissions.Category']", 'symmetrical': 'False'}),
            'description': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
            'text': ('ckeditor.fields.RichTextField', [], {'null': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'emissions.episode': {
            'Meta': {'object_name': 'Episode'},
            'description': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
            'emission': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['emissions.Emission']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
            'text': ('ckeditor.fields.RichTextField', [], {'null': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'emissions.schedule': {
            'Meta': {'object_name': 'Schedule'},
            'datetime': ('django.db.models.fields.DateTimeField', [], {}),
            'emission': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['emissions.Emission']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'rerun': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
        },
        u'emissions.soundfile': {
            'Meta': {'object_name': 'SoundFile'},
            'episode': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['emissions.Episode']"}),
            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '250'}),
            'fragment': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'podcastable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        }
    }

    complete_apps = ['emissions']