# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-30 07:25
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


def is_test_db():
    db_name = settings.DATABASES.get('default', {}).get('NAME', '')
    return (
        True if db_name.startswith('test_') or db_name == ":memory:" else False
    )


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='FusionRow',
            fields=[
                ('object_id', models.PositiveIntegerField()),
                ('row_id', models.PositiveIntegerField(primary_key=True, serialize=False)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
        ),
        migrations.CreateModel(
            name='FusionTable',
            fields=[
                ('table_id', models.CharField(max_length=50, primary_key=True, serialize=False)),
                ('django_model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', unique=True)),
            ],
        ),
        migrations.AlterUniqueTogether(
            name='fusiontable',
            unique_together=set([('django_model', 'table_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='fusionrow',
            unique_together=set([('content_type', 'object_id', 'row_id'), ('content_type', 'object_id')]),
        ),
    ]

    if is_test_db():
        operations.append(
            migrations.CreateModel(
                name='SampleModel',
                fields=[
                    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                    ('date', models.DateField()),
                    ('integer', models.PositiveSmallIntegerField()),
                    ('datetime', models.DateTimeField()),
                    ('text', models.TextField()),
                    ('char', models.CharField(max_length=50)),
                ],
            )
        )
