# Generated manually for role agreement tables
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('jituan', '0017_fund_freeze'),
    ]

    operations = [
        migrations.CreateModel(
            name='ClubRoleAgreement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('club_id', models.CharField(db_index=True, max_length=16)),
                ('role', models.CharField(choices=[('dashou', '打手'), ('guanshi', '管事'), ('zuzhang', '组长')], db_index=True, max_length=16)),
                ('enabled', models.BooleanField(default=False, verbose_name='是否要求签署')),
                ('title', models.CharField(blank=True, default='', max_length=128, verbose_name='协议标题')),
                ('content_text', models.TextField(blank=True, default='', verbose_name='协议正文')),
                ('images_json', models.JSONField(blank=True, default=list, verbose_name='说明图片URL列表')),
                ('version', models.PositiveIntegerField(default=0, verbose_name='已发布版本号')),
                ('published_at', models.DateTimeField(blank=True, null=True)),
                ('updated_by', models.CharField(blank=True, default='', max_length=32)),
                ('CreateTime', models.DateTimeField(auto_now_add=True)),
                ('UpdateTime', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '角色协议',
                'db_table': 'club_role_agreement',
                'unique_together': {('club_id', 'role')},
            },
        ),
        migrations.CreateModel(
            name='ClubRoleAgreementSign',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('club_id', models.CharField(db_index=True, max_length=16)),
                ('user_id', models.CharField(db_index=True, max_length=16, verbose_name='UserUID')),
                ('role', models.CharField(db_index=True, max_length=16)),
                ('agreement_id', models.BigIntegerField(db_index=True, default=0)),
                ('version', models.PositiveIntegerField(db_index=True)),
                ('title_snapshot', models.CharField(blank=True, default='', max_length=128)),
                ('content_snapshot', models.TextField(blank=True, default='')),
                ('images_snapshot', models.JSONField(blank=True, default=list)),
                ('sign_image_url', models.CharField(blank=True, default='', max_length=512)),
                ('client_meta', models.JSONField(blank=True, default=dict)),
                ('signed_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('CreateTime', models.DateTimeField(auto_now_add=True)),
                ('UpdateTime', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '角色协议签署记录',
                'db_table': 'club_role_agreement_sign',
                'unique_together': {('club_id', 'user_id', 'role', 'version')},
            },
        ),
        migrations.AddIndex(
            model_name='clubroleagreementsign',
            index=models.Index(fields=['user_id', 'role', 'version'], name='idx_cras_user_role_ver'),
        ),
        migrations.AddIndex(
            model_name='clubroleagreementsign',
            index=models.Index(fields=['club_id', 'role', 'signed_at'], name='idx_cras_club_role_t'),
        ),
    ]
