# Generated by Django 3.0.5 on 2020-05-28 09:16

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import simple_history.models


class Migration(migrations.Migration):

    dependencies = [
        ('system', '0002_auto_20200516_2213'),
    ]

    operations = [
        migrations.AddField(
            model_name='dict',
            name='code',
            field=models.CharField(blank=True, max_length=30, null=True, verbose_name='代码'),
        ),
        migrations.AddField(
            model_name='dict',
            name='enabled',
            field=models.BooleanField(default=True, verbose_name='是否有效'),
        ),
        migrations.AlterField(
            model_name='role',
            name='datas',
            field=models.CharField(choices=[('全部', '全部'), ('自定义', '自定义'), ('同级及以下', '同级及以下'), ('本级及以下', '本级及以下'), ('本级', '本级'), ('仅本人', '仅本人')], default='本级及以下', max_length=50, verbose_name='数据权限'),
        ),
        migrations.CreateModel(
            name='HistoricalDict',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(blank=True, editable=False, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.CharField(db_index=True, max_length=30, verbose_name='名称')),
                ('code', models.CharField(blank=True, max_length=30, null=True, verbose_name='代码')),
                ('desc', models.TextField(blank=True, null=True, verbose_name='描述')),
                ('enabled', models.BooleanField(default=True, verbose_name='是否有效')),
                ('sort', models.IntegerField(default=1, verbose_name='排序')),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('pid', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='system.Dict', verbose_name='父')),
                ('type', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='system.DictType', verbose_name='类型')),
            ],
            options={
                'verbose_name': 'historical 字典',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='File',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.CharField(blank=True, max_length=30, null=True, verbose_name='名称')),
                ('size', models.IntegerField(blank=True, default=1, null=True, verbose_name='文件大小')),
                ('file', models.FileField(upload_to='%Y/%m/%d/', verbose_name='文件')),
                ('mime', models.CharField(blank=True, max_length=50, null=True, verbose_name='文件格式')),
                ('type', models.CharField(choices=[('文档', '文档'), ('视频', '视频'), ('音频', '音频'), ('图片', '图片'), ('其它', '其它')], default='文档', max_length=50, verbose_name='文件类型')),
                ('path', models.CharField(blank=True, max_length=1000, null=True, verbose_name='地址')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'verbose_name': '文件库',
                'verbose_name_plural': '文件库',
            },
        ),
    ]
