# Generated by Django 4.0.5 on 2023-06-01 13:25

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import taggit.managers
import tinymce.models
import utils.field_utils


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taggit', '0005_auto_20220424_2025'),
        ('mproject', '0001_initial'),
        ('mproduct', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Bug',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('description', tinymce.models.HTMLField(blank=True, default='', null=True, verbose_name='描述')),
                ('level', models.PositiveSmallIntegerField(choices=[(0, 'P0'), (1, 'P1'), (2, 'P2'), (3, 'P3'), (4, 'P4'), (5, 'P5')], default=2, verbose_name='优先级')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='创建日期')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='修改日期')),
                ('severity', models.PositiveSmallIntegerField(choices=[(0, 'O'), (1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5')], default=2, verbose_name='严重等级')),
                ('type', models.CharField(choices=[('code', '代码错误'), ('ui', '界面优化'), ('design', '设计缺陷'), ('conf', '配置相关'), ('deploy', '安装部署'), ('secure', '安全相关'), ('performance', '性能问题'), ('standard', '标准规范'), ('test_script', '测试脚本'), ('else', '其他')], default='code', max_length=20, verbose_name='用例类型')),
                ('status', models.CharField(choices=[('new', '激活'), ('resolved', '已解决'), ('closed', '已关闭')], default='new', max_length=20, verbose_name='状态')),
                ('platform', models.CharField(choices=[('win10', 'Windows 10'), ('win7', 'Windows 7'), ('mac', 'MacOS'), ('centos', 'CentOS'), ('ubuntu', 'ubuntu')], default='win10', max_length=20, verbose_name='操作系统')),
                ('browser', models.CharField(choices=[('chrome', 'Chrome'), ('edge', 'Edge'), ('360', '360'), ('firefox', 'firefox'), ('ie', 'IE')], default='chrome', max_length=20, verbose_name='浏览器')),
                ('assignee', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_assignee', to=settings.AUTH_USER_MODEL, verbose_name='指派给')),
                ('cc_to', models.ManyToManyField(blank=True, related_name='%(app_label)s_%(class)s_cc_to', to=settings.AUTH_USER_MODEL, verbose_name='抄送给')),
                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_operator', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_product', to='mproduct.product', verbose_name='所属产品')),
                ('product_module', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_module', to='mproduct.productmodule', verbose_name='所属模块')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s_project', to='mproject.project', verbose_name='所属项目')),
                ('related_release', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related_release', to='mproduct.productrelease', verbose_name='影响版本')),
                ('related_requirement', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related_requirement', to='mproject.requirement', verbose_name='关联需求')),
                ('related_task', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related_requirement', to='mproject.task', verbose_name='关联任务')),
                ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
            ],
            options={
                'verbose_name': '缺陷',
                'verbose_name_plural': '缺陷',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='TestCase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('description', tinymce.models.HTMLField(blank=True, default='', null=True, verbose_name='描述')),
                ('level', models.PositiveSmallIntegerField(choices=[(0, 'P0'), (1, 'P1'), (2, 'P2'), (3, 'P3'), (4, 'P4'), (5, 'P5')], default=2, verbose_name='优先级')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='创建日期')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='修改日期')),
                ('type', models.CharField(choices=[('func_test', '功能'), ('perf_test', '性能'), ('conf_test', '配置相关'), ('deploy_test', '安装部署'), ('sec_test', '安全相关'), ('api_test', '接口测试'), ('else', '其他')], default='func_test', max_length=20, verbose_name='用例类型')),
                ('stage', models.CharField(choices=[('func_test', '功能测试阶段'), ('integrate_test', '集成测试阶段'), ('sys_test', '系统测试阶段'), ('unit_test', '单元测试阶段'), ('smoke_test', '冒烟测试阶段'), ('version_verify', '版本验证阶段')], default='prod', max_length=20, verbose_name='适用阶段')),
                ('pre_condition', tinymce.models.HTMLField(blank=True, verbose_name='预置条件')),
                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_operator', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_product', to='mproduct.product', verbose_name='所属产品')),
                ('product_module', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_module', to='mproduct.productmodule', verbose_name='所属模块')),
                ('related_requirement', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related_requirement', to='mproject.requirement', verbose_name='关联需求')),
                ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
            ],
            options={
                'verbose_name': '测试用例',
                'verbose_name_plural': '测试用例',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='TestPlan',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('description', tinymce.models.HTMLField(blank=True, default='', null=True, verbose_name='描述')),
                ('level', models.PositiveSmallIntegerField(choices=[(0, 'P0'), (1, 'P1'), (2, 'P2'), (3, 'P3'), (4, 'P4'), (5, 'P5')], default=2, verbose_name='优先级')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='创建日期')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='修改日期')),
                ('start_date', models.DateField(blank=True, default=datetime.date.today, null=True, verbose_name='开始日期')),
                ('end_date', models.DateField(blank=True, default=datetime.date.today, null=True, verbose_name='结束日期')),
                ('status', models.CharField(choices=[('new', '未开始'), ('processing', '进行中'), ('blocked', '被阻碍'), ('done', '完成')], default='new', max_length=20, verbose_name='当前状态')),
                ('test_summary', tinymce.models.HTMLField(blank=True, null=True, verbose_name='测试总结')),
                ('cc_to', models.ManyToManyField(blank=True, related_name='%(app_label)s_%(class)s_cc_to', to=settings.AUTH_USER_MODEL, verbose_name='抄送给')),
                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('manager', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_manager', to=settings.AUTH_USER_MODEL, verbose_name='负责人')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_operator', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s_project', to='mproject.project', verbose_name='所属项目')),
                ('related_release', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_related_version', to='mproduct.productrelease', verbose_name='关联版本')),
            ],
            options={
                'verbose_name': '测试计划',
                'verbose_name_plural': '测试计划',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='TestStep',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('order', models.PositiveSmallIntegerField(default=1, verbose_name='顺序')),
                ('excepted', models.CharField(blank=True, max_length=200, null=True, verbose_name='预期')),
                ('test_case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_test_case', to='mtest.testcase', verbose_name='测试用例')),
            ],
            options={
                'verbose_name': '测试步骤',
                'verbose_name_plural': '测试步骤',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='TestPlanCase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('test_start_time', models.DateTimeField(default=datetime.datetime.now, verbose_name='执行时间')),
                ('test_result', models.CharField(blank=True, choices=[('pass', '通过'), ('fail', '失败'), ('error', '异常')], max_length=20, null=True, verbose_name='结果')),
                ('test_status', models.CharField(blank=True, choices=[('new', '未开始'), ('done', '已完成')], max_length=20, null=True, verbose_name='状态')),
                ('test_case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_test_case', to='mtest.testcase', verbose_name='测试用例')),
                ('test_plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_test_case', to='mtest.testplan', verbose_name='测试计划')),
                ('tester', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_operator', to=settings.AUTH_USER_MODEL, verbose_name='执行人')),
            ],
            options={
                'verbose_name': '测试用例',
                'verbose_name_plural': '测试用例',
                'ordering': ['id'],
            },
        ),
        migrations.AddField(
            model_name='testplan',
            name='test_cases',
            field=models.ManyToManyField(blank=True, through='mtest.TestPlanCase', to='mtest.testcase', verbose_name='用例'),
        ),
        migrations.CreateModel(
            name='TestCaseRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('ok', '正常'), ('error', '异常'), ('pass', '通过'), ('fail', '失败')], default='ok', max_length=20, verbose_name='状态')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='创建日期')),
                ('data', utils.field_utils.YamlField(blank=True, null=True, verbose_name='测试结果数据')),
                ('test_case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_test_case', to='mtest.testcase', verbose_name='测试用例')),
            ],
            options={
                'verbose_name': '测试用例记录',
                'verbose_name_plural': '测试用例记录',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='TestAttachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('file', models.FileField(upload_to='uploads/', verbose_name='附件')),
                ('bug', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_test_case', to='mtest.bug', verbose_name='Bug')),
                ('test_case', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_test_case', to='mtest.testcase', verbose_name='测试用例')),
            ],
            options={
                'verbose_name': '附件',
                'verbose_name_plural': '附件',
                'ordering': ['id'],
            },
        ),
    ]
