49 lines
3.0 KiB
Python
49 lines
3.0 KiB
Python
# Generated for user activation audit and role assignment
|
|
import uuid_utils.compat
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('users', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='UserActivationApplication',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid_utils.compat.uuid7, editable=False, primary_key=True, serialize=False, verbose_name='主键id')),
|
|
('email', models.EmailField(blank=True, default='', max_length=254, verbose_name='注册邮箱')),
|
|
('email_verified', models.BooleanField(default=False, verbose_name='邮箱是否已验证')),
|
|
('status', models.CharField(choices=[('PENDING', '待审核'), ('APPROVED', '已通过'), ('REJECTED', '已拒绝')], db_index=True, default='PENDING', max_length=20, verbose_name='审核状态')),
|
|
('applied_at', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='申请时间')),
|
|
('audit_time', models.DateTimeField(blank=True, null=True, verbose_name='审核时间')),
|
|
('reject_reason', models.CharField(blank=True, default='', max_length=500, verbose_name='拒绝原因')),
|
|
('audit_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='users.user', verbose_name='审核人')),
|
|
('user', models.OneToOneField(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, related_name='activation_application', to='users.user', verbose_name='关联用户')),
|
|
],
|
|
options={
|
|
'db_table': 'user_activation_application',
|
|
'ordering': ['-applied_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='UserRoleAssignment',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid_utils.compat.uuid7, editable=False, primary_key=True, serialize=False, verbose_name='主键id')),
|
|
('role_id', models.CharField(db_index=True, default='USER', max_length=64, verbose_name='角色标识')),
|
|
('workspace_id', models.CharField(db_index=True, default='default', max_length=128, verbose_name='工作空间id')),
|
|
('granted_at', models.DateTimeField(auto_now_add=True, verbose_name='授权时间')),
|
|
('granted_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='users.user', verbose_name='授权人')),
|
|
('user', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, related_name='role_assignments', to='users.user', verbose_name='用户')),
|
|
],
|
|
options={
|
|
'db_table': 'user_role_assignment',
|
|
'ordering': ['granted_at'],
|
|
'unique_together': {('user', 'role_id', 'workspace_id')},
|
|
},
|
|
),
|
|
]
|