# Generated by Django 2.0.5 on 2018-05-19 18:13

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_tenants.postgresql_backend.base


class Migration(migrations.Migration):

    replaces = [('master', '0001_initial'), ('master', '0002_masteruser'), ('master', '0003_remove_masteruser_is_admin')]

    initial = True

    dependencies = [
        ('users', '0002_user_display_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Domain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('domain', models.CharField(db_index=True, max_length=253, unique=True)),
                ('is_primary', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ('is_primary',),
            },
        ),
        migrations.CreateModel(
            name='Tenant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('schema_name', models.CharField(max_length=63, unique=True, validators=[django_tenants.postgresql_backend.base._check_schema_name])),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='domain',
            name='tenant',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='domains', to='master.Tenant'),
        ),
        migrations.CreateModel(
            name='MasterUser',
            fields=[
                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'base_manager_name': 'objects',
                'abstract': False,
            },
            bases=('users.user',),
        ),
    ]
