# Generated by Django 3.2.5 on 2023-04-18 22:56

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


class Migration(migrations.Migration):

    dependencies = [
        ('xj_user', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='BaseInfo',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('user_name', models.CharField(blank=True, db_index=True, help_text='登录的用户名', max_length=128, null=True, unique=True, verbose_name='用户名')),
                ('full_name', models.CharField(blank=True, db_index=True, help_text='用户的真实姓名（未实名验证）', max_length=128, null=True, verbose_name='姓名')),
                ('nickname', models.CharField(blank=True, max_length=128, null=True, verbose_name='昵称')),
                ('phone', models.CharField(blank=True, db_index=True, help_text='登录用的手机号', max_length=128, null=True, unique=True, verbose_name='手机')),
                ('email', models.EmailField(blank=True, db_index=True, help_text='登录用的邮箱', max_length=254, null=True, unique=True, verbose_name='邮箱')),
                ('user_info', models.JSONField(blank=True, help_text='用户扩展信息', null=True, verbose_name='用户信息')),
                ('user_type', models.CharField(blank=True, help_text='PERSON 个人, COMPANY 公司类型', max_length=255, null=True, verbose_name='用户类型')),
                ('privacies', models.JSONField(blank=True, help_text='用户隐私设置', null=True, verbose_name='用户隐私设置')),
                ('register_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='注册时间')),
            ],
            options={
                'verbose_name_plural': '01. 用户 - 基础信息',
                'db_table': 'user_base_info',
            },
        ),
        migrations.CreateModel(
            name='ExtendField',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('field', models.CharField(blank=True, db_index=True, help_text='当已有字段不能满足的时候的扩展字段', max_length=50, null=True, unique=True, verbose_name='自定义字段')),
                ('field_index', models.CharField(blank=True, help_text='映射到扩展数据表的字段名，如：field_x', max_length=255, null=True, unique=True, verbose_name='映射索引名')),
                ('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段描述')),
                ('type', models.CharField(blank=True, choices=[('image', '图片-image'), ('text', '输入框-text'), ('plain', '禁止编辑-plain'), ('number', '数字类型-number'), ('time', ' 时间类型-time'), ('select', '选择框-select'), ('upload', '上传类型-upload'), ('textarea', '文本域-textarea'), ('password', '密码-password'), ('switch', '开关-switch'), ('radio', '视频-radio'), ('checkBox', '多选-checkBox'), ('date', '日期-date'), ('month', '月份-month'), ('year', '年-year'), ('cascader', '多选-cascader'), ('slot', '插槽-slot'), ('editor', '富文本-editor')], max_length=255, null=True, verbose_name='类型')),
                ('config', models.JSONField(blank=True, null=True, verbose_name='配置')),
                ('default', models.CharField(blank=True, max_length=255, null=True, verbose_name='默认值')),
                ('sort', models.IntegerField(blank=True, null=True, verbose_name='排序')),
            ],
            options={
                'verbose_name_plural': '04. 用户 - 扩展字段',
                'db_table': 'user_extend_field',
            },
        ),
        migrations.CreateModel(
            name='Permission',
            fields=[
                ('permission_id', models.IntegerField(help_text='必填。不自动生成，由运营人员统一设置。', primary_key=True, serialize=False, verbose_name='权限ID')),
                ('permission_name', models.CharField(blank=True, help_text='权限名称', max_length=255, null=True, verbose_name='权限名称')),
            ],
            options={
                'verbose_name_plural': '09. 用户 - 权限组表',
                'db_table': 'user_permission',
            },
        ),
        migrations.CreateModel(
            name='Platform',
            fields=[
                ('platform_id', models.IntegerField(help_text='必填。不自动生成，由运营人员统一设置。', primary_key=True, serialize=False, verbose_name='平台ID')),
                ('platform_name', models.CharField(help_text='必填。平台名称可以是中文、英文、俄文等。', max_length=128, verbose_name='平台名称')),
                ('platform_code', models.CharField(help_text='必填。自动生成8为随机编码', max_length=8, verbose_name='平台编码')),
            ],
            options={
                'verbose_name_plural': '07. 用户 - 平台表',
                'db_table': 'user_platform',
            },
        ),
        migrations.CreateModel(
            name='UserRelateType',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('relate_key', models.CharField(blank=True, default='', max_length=50, null=True, verbose_name='关系搜索key')),
                ('relate_name', models.CharField(blank=True, default='', max_length=50, null=True, verbose_name='关系搜索名称')),
                ('description', models.CharField(blank=True, default='', max_length=255, null=True, verbose_name='关系描述')),
            ],
            options={
                'verbose_name_plural': '13. 用户 - 关系类型表',
                'db_table': 'user_relate_type',
            },
        ),
        migrations.CreateModel(
            name='UserSsoServe',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sso_code', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录代码')),
                ('sso_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录名')),
                ('sso_url', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录地址')),
                ('sso_appid', models.CharField(blank=True, max_length=255, null=True, verbose_name='appid')),
                ('description', models.CharField(blank=True, max_length=255, null=True, verbose_name='描述')),
                ('sso_account', models.ForeignKey(db_column='sso_account_id', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '11. 用户 - 单点登录服务表',
                'db_table': 'user_sso_serve',
            },
        ),
        migrations.CreateModel(
            name='UserSsoToUser',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sso_unicode', models.CharField(blank=True, max_length=255, null=True, verbose_name='单点登录地址')),
                ('sso_ticket', models.CharField(blank=True, max_length=255, null=True, verbose_name='描述')),
                ('app_id', models.CharField(blank=True, max_length=255, null=True, verbose_name='服务授权app')),
                ('union_code', models.CharField(blank=True, max_length=255, null=True, verbose_name='微信唯一ID')),
                ('sso_serve', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.userssoserve', verbose_name='单点登录服务ID')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '12. 用户 - 多对多单点登录记录表',
                'db_table': 'user_sso_to_user',
            },
        ),
        migrations.CreateModel(
            name='UserRelateToUser',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='relate_user_id_alias', to='xj_user.baseinfo', verbose_name='关系人')),
                ('user_relate_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.userrelatetype', verbose_name='关系类型ID')),
                ('with_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='relate_with_user_id_alias', to='xj_user.baseinfo', verbose_name='关联关系人')),
            ],
            options={
                'verbose_name_plural': '14. 用户 - 多对多关系类型表',
                'db_table': 'user_relate_to_user',
            },
        ),
        migrations.CreateModel(
            name='RestrictRegion',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('region_code', models.BigIntegerField(blank=True, db_index=True, help_text='在国内参考 GB/T2260-2002中国行政区划代码，有6位数 9位数 12位数，非中国地区以9开头', null=True, verbose_name='允许的行政区划编码')),
                ('user', models.ForeignKey(help_text='用户ID', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '07. 用户 - 限制范围表',
                'db_table': 'user_restrict_region',
            },
        ),
        migrations.CreateModel(
            name='PermissionValue',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('module', models.CharField(blank=True, max_length=255, null=True, verbose_name='模型名称')),
                ('feature', models.CharField(blank=True, help_text='group: 按用户组给权限, route: 按路由给权限, point: 按交互点给权限, ..., category: 类别权限', max_length=255, null=True, verbose_name='功能专注点')),
                ('permission_value', models.CharField(blank=True, help_text='权限标识值，一个permission_id可以对应多个value，多值形成一组权限。值为宏名，需要多语言翻译', max_length=255, null=True, verbose_name='权限标识值')),
                ('type', models.CharField(blank=True, help_text='暂不使用', max_length=255, null=True, verbose_name='类型')),
                ('relate_value', models.CharField(blank=True, max_length=255, null=True, verbose_name='权限内容关联值')),
                ('config', models.JSONField(blank=True, help_text='权限更多配置，常用于前端路由', max_length=255, null=True, verbose_name='权限更多配置')),
                ('is_enable', models.CharField(blank=True, max_length=1, null=True, verbose_name='是否启用权限')),
                ('is_system', models.CharField(blank=True, help_text='是否系统权限，系统权限不可以删除，默认SUPER_ADMINISTRATOR的所有value都是系统权限。', max_length=1, null=True, verbose_name='是否系统权限')),
                ('is_ban', models.CharField(blank=True, help_text='是否全部禁用该权限，Y禁用，N允许，默认N。使用减法原则，约定无权限值则视为允许。', max_length=1, null=True, verbose_name='是否禁用')),
                ('ban_view', models.CharField(blank=True, max_length=1, null=True, verbose_name='是否可看')),
                ('ban_edit', models.CharField(blank=True, max_length=1, null=True, verbose_name='是否编辑')),
                ('ban_add', models.CharField(blank=True, max_length=1, null=True, verbose_name='是否插入')),
                ('ban_delete', models.CharField(blank=True, max_length=1, null=True, verbose_name='是否删除')),
                ('description', models.CharField(blank=True, max_length=1, null=True, verbose_name='权限值')),
                ('permission_code', models.BooleanField(blank=True, null=True, verbose_name='是否系统权限')),
                ('permission', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.permission', verbose_name='权限ID')),
            ],
            options={
                'verbose_name_plural': '10. 用户 - 权限组值表',
                'db_table': 'user_permission_value',
            },
        ),
        migrations.CreateModel(
            name='History',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('field', models.CharField(blank=True, help_text='被用户修改的字段', max_length=32, null=True, verbose_name='操作字段')),
                ('old_value', models.CharField(blank=True, help_text='修改前的值', max_length=255, null=True, verbose_name='旧值')),
                ('new_value', models.CharField(blank=True, help_text='修改后的值', max_length=255, null=True, verbose_name='新值')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('user', models.ForeignKey(help_text='用户ID', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '06. 用户 - 操作历史表',
                'db_table': 'user_history',
            },
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('group', models.CharField(blank=True, max_length=32, null=True, verbose_name='用户组')),
                ('parent_group', models.CharField(blank=True, max_length=32, null=True, verbose_name='父组')),
                ('description', models.CharField(blank=True, max_length=32, null=True, verbose_name='描述')),
                ('permission', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.permission', verbose_name='权限ID')),
            ],
            options={
                'verbose_name_plural': '11. 用户 - 分组表',
                'db_table': 'user_group',
            },
        ),
        migrations.CreateModel(
            name='DetailInfo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('real_name', models.CharField(blank=True, db_index=True, help_text='实名认证后的真名', max_length=255, null=True, verbose_name='真实姓名')),
                ('sex', models.CharField(blank=True, choices=[('0', '未知'), ('1', '男'), ('2', '女')], help_text='0未知 1男 2女', max_length=1, null=True, verbose_name='性别')),
                ('birth', models.DateField(blank=True, null=True, verbose_name='生日')),
                ('tags', models.CharField(blank=True, help_text='多个标签以英文;号为分隔符', max_length=255, null=True, verbose_name='个人标签')),
                ('signature', models.CharField(blank=True, max_length=255, null=True, verbose_name='个性签名')),
                ('avatar', models.CharField(blank=True, max_length=255, null=True, verbose_name='个人头像')),
                ('cover', models.CharField(blank=True, max_length=255, null=True, verbose_name='个人封面')),
                ('language', models.CharField(blank=True, max_length=32, null=True, verbose_name='语言')),
                ('region_code', models.BigIntegerField(blank=True, db_index=True, null=True, verbose_name='行政区划编码')),
                ('more', models.JSONField(blank=True, help_text='更多信息用来存放用户可能填写的扩展内容，由于很多信息不是必填或必须存在的，因此不单独建字段。', max_length=255, null=True, verbose_name='更多信息')),
                ('field_1', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段1')),
                ('field_2', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段2')),
                ('field_3', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段3')),
                ('field_4', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段4')),
                ('field_5', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段5')),
                ('field_6', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段6')),
                ('field_7', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段7')),
                ('field_8', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段8')),
                ('field_9', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段9')),
                ('field_10', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段10')),
                ('field_11', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段11')),
                ('field_12', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段12')),
                ('field_13', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段13')),
                ('field_14', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段14')),
                ('field_15', models.CharField(blank=True, max_length=255, null=True, verbose_name='字段15')),
                ('user', models.OneToOneField(help_text='登录用的用户名', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '03. 用户 - 详细信息',
                'db_table': 'user_detail_info',
            },
        ),
        migrations.CreateModel(
            name='ContactBook',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phone', models.JSONField(blank=True, null=True, verbose_name='手机号')),
                ('phones', models.JSONField(blank=True, null=True, verbose_name='多个手机号')),
                ('telephone', models.JSONField(blank=True, null=True, verbose_name='电话号码')),
                ('telephones', models.JSONField(blank=True, null=True, verbose_name='多个电话号码')),
                ('email', models.EmailField(blank=True, db_index=True, help_text='邮箱', max_length=254, null=True, unique=True, verbose_name='邮箱')),
                ('qq', models.CharField(blank=True, max_length=255, null=True, verbose_name='QQ')),
                ('address', models.CharField(blank=True, max_length=255, null=True, verbose_name='地址')),
                ('more', models.JSONField(blank=True, null=True, verbose_name='更多')),
                ('remarks', models.CharField(blank=True, max_length=255, null=True, verbose_name='标记')),
                ('friend', models.ForeignKey(help_text='待删', on_delete=django.db.models.deletion.DO_NOTHING, related_name='friend_set', to='xj_user.baseinfo', verbose_name='朋友')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='user_set', to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '10. 用户 - 联系簿表',
                'db_table': 'user_contact_book',
            },
        ),
        migrations.CreateModel(
            name='Auth',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(blank=True, help_text='登录的密码', max_length=255, null=True, verbose_name='密码')),
                ('plaintext', models.CharField(blank=True, max_length=255, null=True, verbose_name='PT')),
                ('salt', models.CharField(blank=True, help_text='加密盐由六位数字和字母组成，区分大小写', max_length=32, null=True, verbose_name='盐')),
                ('algorithm', models.CharField(blank=True, help_text='系统同时支持多种加密算法，旧版为MD5，新版为SHA1', max_length=255, null=True, verbose_name='加密算法')),
                ('token', models.CharField(blank=True, help_text='用户令牌，用于验证用户有效期', max_length=255, null=True, verbose_name='临时令牌')),
                ('ticket', models.CharField(blank=True, help_text='用户提供第三方单点登录的票据', max_length=255, null=True, verbose_name='临时票据')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, null=True, verbose_name='最后登录时间')),
                ('user', models.ForeignKey(help_text='登录的用户名', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '02. 用户 - 安全认证',
                'db_table': 'user_auth',
            },
        ),
        migrations.CreateModel(
            name='AccessLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip', models.CharField(blank=True, help_text='登录的IP地址', max_length=128, null=True, verbose_name='IP')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('client_info', models.JSONField(blank=True, null=True, verbose_name='客户端信息')),
                ('more', models.JSONField(blank=True, help_text='留用', max_length=255, null=True, verbose_name='更多信息')),
                ('user', models.ForeignKey(help_text='用户ID', on_delete=django.db.models.deletion.DO_NOTHING, to='xj_user.baseinfo', verbose_name='用户')),
            ],
            options={
                'verbose_name_plural': '05. 用户 - 访问日志表',
                'db_table': 'user_access_log',
            },
        ),
    ]
