# Generated by Django 3.1.4 on 2022-02-08 15:19

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


class Migration(migrations.Migration):

    dependencies = [
        ('company', '0277_remove_cgroup_privileges'),
        ('rbac', '0024_pgroup_privilege'),
    ]

    operations = [
        migrations.CreateModel(
            name='CoPrivilege',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('actions', models.JSONField(blank=True, default=list, null=True, verbose_name='授权操作')),
                ('cgroups', models.JSONField(blank=True, default=list, null=True, verbose_name='授权组别')),
                ('users', models.JSONField(blank=True, default=list, null=True, verbose_name='授权用户')),
                ('remark', models.CharField(blank=True, max_length=50, null=True, verbose_name='备注说明')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='company.company', verbose_name='企业名称')),
            ],
            options={
                'verbose_name': '企业功能权限',
                'verbose_name_plural': '企业功能权限',
            },
        ),
        migrations.CreateModel(
            name='PrvAction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True, verbose_name='操作名称')),
                ('remark', models.CharField(blank=True, max_length=50, null=True, verbose_name='备注说明')),
            ],
            options={
                'verbose_name': '权限操作',
                'verbose_name_plural': '权限操作',
            },
        ),
        migrations.CreateModel(
            name='PrvCat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, unique=True, verbose_name='大类名称')),
                ('sn', models.SmallIntegerField(blank=True, default=0, null=True, verbose_name='序号')),
                ('remark', models.CharField(blank=True, max_length=50, null=True, verbose_name='备注说明')),
            ],
            options={
                'verbose_name': '权限大类',
                'verbose_name_plural': '权限大类',
                'ordering': ['sn', 'name'],
            },
        ),
        migrations.CreateModel(
            name='PrvSub',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, verbose_name='子类名称')),
                ('sn', models.SmallIntegerField(blank=True, default=0, null=True, verbose_name='序号')),
                ('remark', models.CharField(blank=True, max_length=50, null=True, verbose_name='权限子类')),
                ('cat', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rbac.prvcat', verbose_name='权限大类')),
            ],
            options={
                'verbose_name': '权限子类',
                'verbose_name_plural': '权限子类',
                'ordering': ['cat', 'sn', 'name'],
                'unique_together': {('cat', 'name')},
            },
        ),
        migrations.AlterModelOptions(
            name='privilege',
            options={'verbose_name': '系统功能权限', 'verbose_name_plural': '企业功能权限'},
        ),
        migrations.RemoveField(
            model_name='privilege',
            name='pgroup',
        ),
        migrations.RemoveField(
            model_name='privilege',
            name='status',
        ),
        migrations.AddField(
            model_name='privilege',
            name='actions',
            field=models.JSONField(blank=True, default=list, null=True, verbose_name='可授权的操作'),
        ),
        migrations.AddField(
            model_name='privilege',
            name='dj_content_id',
            field=models.IntegerField(blank=True, null=True, verbose_name='django_content_type'),
        ),
        migrations.AddField(
            model_name='privilege',
            name='remark',
            field=models.CharField(blank=True, max_length=50, null=True, verbose_name='备注说明'),
        ),
        migrations.AlterField(
            model_name='privilege',
            name='is_menu',
            field=models.BooleanField(default=False, verbose_name='是否是菜单'),
        ),
        migrations.DeleteModel(
            name='PGroup',
        ),
        migrations.AddField(
            model_name='coprivilege',
            name='privilege',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='rbac.privilege', verbose_name='系统功能权限'),
        ),
        migrations.AddField(
            model_name='privilege',
            name='cat',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rbac.prvcat', verbose_name='大类'),
        ),
        migrations.AddField(
            model_name='privilege',
            name='sub',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rbac.prvsub', verbose_name='子类'),
        ),
    ]
