# -*- 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 'Region'
        db.create_table(u'orders_region', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.TextField')()),
            ('code', self.gf('django.db.models.fields.CharField')(unique=True, max_length=10)),
            ('to_download', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('waiting', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('downloaded', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('ordered', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('downloadable', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('channel_count_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('length_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('mismatch_data_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('no_link_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal(u'orders', ['Region'])

        # Adding model 'UIK'
        db.create_table(u'orders_uik', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.TextField')()),
            ('code', self.gf('django.db.models.fields.CharField')(unique=True, max_length=10)),
            ('to_download', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('waiting', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('downloaded', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('ordered', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('downloadable', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('channel_count_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('length_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('mismatch_data_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('no_link_err', self.gf('django.db.models.fields.IntegerField')(default=0)),
            ('num', self.gf('django.db.models.fields.IntegerField')(null=True)),
            ('region', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orders.Region'])),
            ('tmin', self.gf('django.db.models.fields.DateTimeField')(null=True)),
            ('tmax', self.gf('django.db.models.fields.DateTimeField')(null=True)),
        ))
        db.send_create_signal(u'orders', ['UIK'])

        # Adding model 'Order'
        db.create_table(u'orders_order', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('uik', self.gf('django.db.models.fields.related.ForeignKey')(related_name='orders', to=orm['orders.UIK'])),
            ('orderid', self.gf('django.db.models.fields.CharField')(unique=True, max_length=20, db_index=True)),
            ('orderstatus', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)),
            ('created', self.gf('django.db.models.fields.DateTimeField')()),
            ('tstart', self.gf('django.db.models.fields.DateTimeField')(null=True)),
            ('tend', self.gf('django.db.models.fields.DateTimeField')(null=True)),
            ('to_download', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('waiting', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('downloaded', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('unavailable', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('channel_count_err', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('length_err', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('mismatch_data_err', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('no_link_err', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('archive_data', self.gf('picklefield.fields.PickledObjectField')(null=True)),
            ('archive_urls', self.gf('picklefield.fields.PickledObjectField')(null=True)),
        ))
        db.send_create_signal(u'orders', ['Order'])


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

        # Deleting model 'UIK'
        db.delete_table(u'orders_uik')

        # Deleting model 'Order'
        db.delete_table(u'orders_order')


    models = {
        u'orders.order': {
            'Meta': {'object_name': 'Order'},
            'archive_data': ('picklefield.fields.PickledObjectField', [], {'null': 'True'}),
            'archive_urls': ('picklefield.fields.PickledObjectField', [], {'null': 'True'}),
            'channel_count_err': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'created': ('django.db.models.fields.DateTimeField', [], {}),
            'downloaded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'length_err': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'mismatch_data_err': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'no_link_err': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'orderid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20', 'db_index': 'True'}),
            'orderstatus': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
            'tend': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'to_download': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'tstart': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'uik': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'orders'", 'to': u"orm['orders.UIK']"}),
            'unavailable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'waiting': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
        },
        u'orders.region': {
            'Meta': {'ordering': "['name']", 'object_name': 'Region'},
            'channel_count_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
            'downloadable': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'downloaded': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'length_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'mismatch_data_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'name': ('django.db.models.fields.TextField', [], {}),
            'no_link_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'ordered': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'to_download': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'waiting': ('django.db.models.fields.IntegerField', [], {'default': '0'})
        },
        u'orders.uik': {
            'Meta': {'object_name': 'UIK'},
            'channel_count_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
            'downloadable': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'downloaded': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'length_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'mismatch_data_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'name': ('django.db.models.fields.TextField', [], {}),
            'no_link_err': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'num': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
            'ordered': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'region': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orders.Region']"}),
            'tmax': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'tmin': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'to_download': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'waiting': ('django.db.models.fields.IntegerField', [], {'default': '0'})
        }
    }

    complete_apps = ['orders']