# Generated by Django 3.2.4 on 2021-09-09 21:38

from django.db import migrations, models
import django.db.models.deletion
import multi_tenant.tenant.models.user


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Tenant',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('create_date', models.DateTimeField(auto_now_add=True)),
                ('name', models.CharField(max_length=20, unique=True)),
                ('label', models.CharField(max_length=200)),
                ('code', models.CharField(max_length=10, unique=True)),
                ('db_password', models.CharField(blank=True, max_length=128, null=True)),
                ('db_name', models.CharField(max_length=50)),
                ('engine', models.CharField(choices=[('Mysql', 'Mysql'), ('SQLite', 'SQLite'), ('Postgres', 'Postgres'), ('Oracle', 'Oracle')], max_length=10, null=True)),
                ('options', models.JSONField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name': '租户',
                'verbose_name_plural': '租户',
                'db_table': 'auth_tenant',
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='GlobalUser',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('username', models.CharField(max_length=50, unique=True)),
                ('password', models.CharField(max_length=128)),
                ('is_active', models.BooleanField(default=True)),
                ('is_staff', models.BooleanField(default=False)),
                ('is_super', models.BooleanField(default=False)),
                ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='tenant.tenant', to_field='code')),
            ],
            options={
                'verbose_name': '全局用户',
                'verbose_name_plural': '全局用户',
                'abstract': False,
            },
            managers=[
                ('objects', multi_tenant.tenant.models.user.UserManager()),
            ],
        ),
    ]
