# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-24 17:52
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import hacs.fields
import hacs.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='ContentTypeRoutingTable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.PositiveIntegerField()),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('created_on', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='Created On')),
                ('updated_on', models.DateTimeField(blank=True, null=True, verbose_name='Last updated')),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'db_table': 'hacs_ct_routing_table',
                'verbose_name': 'content type routing table',
                'verbose_name_plural': 'content types routing table',
            },
            managers=[
                ('objects', hacs.models.ContentTypeRoutingTableManager()),
            ],
        ),
        migrations.CreateModel(
            name='RoutingTable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('route_name', models.SlugField(max_length=127, unique=True, verbose_name='route name')),
                ('description', models.TextField(blank=True, null=True, verbose_name='description')),
                ('urls', hacs.fields.SequenceField(verbose_name='URLs')),
                ('handlers', hacs.fields.DictField(blank=True, default='', null=True, verbose_name='Handlers')),
                ('generated_module', models.TextField(blank=True, default=None, null=True, verbose_name='Generated Module')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('is_deleted', models.BooleanField(default=False, verbose_name='Soft Delete')),
                ('created_on', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='Created On')),
                ('updated_on', models.DateTimeField(blank=True, null=True, verbose_name='Last updated')),
            ],
            options={
                'db_table': 'hacl_routing_table',
                'verbose_name': 'routing table',
                'verbose_name_plural': 'routes table',
            },
            managers=[
                ('objects', hacs.models.RoutingTableManager()),
            ],
        ),
        migrations.CreateModel(
            name='SiteRoutingTable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('created_on', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='Created On')),
                ('updated_on', models.DateTimeField(blank=True, null=True, verbose_name='Last updated')),
                ('route', models.ForeignKey(db_column='route_id', db_constraint=False, on_delete=django.db.models.deletion.CASCADE, related_name='hacs_route_sites', to='hacs.RoutingTable')),
                ('site', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='hacs_site_routes', to='sites.Site')),
            ],
            options={
                'db_table': 'hacs_sites_routing_table',
                'verbose_name': 'site routing table',
                'verbose_name_plural': 'sites routing table',
            },
            managers=[
                ('objects', hacs.models.SiteRoutingTableManager()),
            ],
        ),
        migrations.AddField(
            model_name='contenttyperoutingtable',
            name='route',
            field=models.ForeignKey(db_column='route_id', db_constraint=False, on_delete=django.db.models.deletion.CASCADE, related_name='hacs_route_contenttypes', to='hacs.RoutingTable'),
        ),
        migrations.AddField(
            model_name='contenttyperoutingtable',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hacs_site_contenttypes_at_routing_table', to='sites.Site'),
        ),
        migrations.AlterUniqueTogether(
            name='contenttyperoutingtable',
            unique_together=set([('site', 'content_type', 'object_id')]),
        ),
    ]
