# Generated by Django 3.2.18 on 2023-04-01 16:19

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('name', models.CharField(max_length=50, unique=True)),
                ('real_name', models.CharField(max_length=50, null=True)),
                ('password', models.CharField(max_length=50)),
                ('email', models.CharField(max_length=100, null=True, unique=True)),
                ('gender', models.IntegerField(choices=[(0, 'Unknown'), (1, 'Female'), (2, 'Male')], default=0)),
                ('avatar_url', models.CharField(max_length=255)),
                ('signature', models.CharField(default=None, max_length=255, null=True)),
                ('title_name', models.CharField(max_length=50, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Auth',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('type', models.CharField(choices=[('admin', 'Admin'), ('super admin', 'Superadmin'), ('common', 'Common'), ('contest', 'Contest')], default='common', max_length=50)),
                ('permission', models.CharField(max_length=50)),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('role', models.CharField(choices=[('admin', 'Admin'), ('teacher', 'Teacher'), ('tourist', 'Tourist'), ('user', 'User')], default='user', max_length=50)),
                ('description', models.CharField(max_length=50, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('accounts', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.account')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RoleAuthLink',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('auth_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.auth')),
                ('role_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.role')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='auth',
            name='roles',
            field=models.ManyToManyField(through='account.RoleAuthLink', to='account.Role'),
        ),
    ]
