# 转盘奖品库存 + 运营控奖表

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('products', '0013_zhuanpan_and_zhuanqu_icon'),
    ]

    operations = [
        migrations.AddField(
            model_name='zhuanpanjiangpin',
            name='kucun',
            field=models.IntegerField(
                default=-1,
                help_text='-1=不限；0=不可抽中（控奖仍可强制）；>0 抽中后减一',
                verbose_name='剩余库存',
            ),
        ),
        migrations.CreateModel(
            name='ZhuanpanKongjiang',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('club_id', models.CharField(db_index=True, max_length=16, verbose_name='俱乐部')),
                ('huodong_id', models.PositiveIntegerField(db_index=True, verbose_name='活动ID')),
                ('yonghuid', models.CharField(db_index=True, max_length=32, verbose_name='用户UID')),
                ('jiangpin_id', models.PositiveIntegerField(db_index=True, verbose_name='指定奖品ID')),
                ('cishu', models.PositiveIntegerField(default=1, verbose_name='剩余次数')),
                ('qiyong', models.BooleanField(db_index=True, default=True, verbose_name='是否启用')),
                ('beizhu', models.CharField(blank=True, default='', max_length=200, verbose_name='备注')),
                ('CreateTime', models.DateTimeField(auto_now_add=True)),
                ('UpdateTime', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '转盘控奖',
                'verbose_name_plural': '转盘控奖',
                'db_table': 'zhuanpan_kongjiang',
            },
        ),
        migrations.AddIndex(
            model_name='zhuanpankongjiang',
            index=models.Index(fields=['club_id', 'yonghuid', 'qiyong'], name='zhuanpan_kj_club_uid_qy_idx'),
        ),
        migrations.AddIndex(
            model_name='zhuanpankongjiang',
            index=models.Index(fields=['huodong_id', 'yonghuid'], name='zhuanpan_kj_hd_uid_idx'),
        ),
    ]
