# Generated by Django 2.0.7 on 2018-09-07 11:52

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Action',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('code', models.CharField(max_length=100, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.FloatField(default=0)),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='action_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='action_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
            ],
            options={
                'ordering': ['type', 'order'],
            },
        ),
        migrations.CreateModel(
            name='ActionType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('code', models.CharField(max_length=100, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='Case',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='case_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='case_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='CaseResult',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('variable_group', models.TextField(blank=True, null=True)),
                ('parent_case_pk_list', models.TextField(blank=True, null=True)),
                ('case_order', models.IntegerField(blank=True, null=True)),
                ('start_date', models.DateTimeField(blank=True, null=True, verbose_name='开始时间')),
                ('end_date', models.DateTimeField(blank=True, null=True, verbose_name='结束时间')),
                ('execute_count', models.IntegerField(blank=True, null=True)),
                ('pass_count', models.IntegerField(blank=True, null=True)),
                ('fail_count', models.IntegerField(blank=True, null=True)),
                ('error_count', models.IntegerField(blank=True, null=True)),
                ('result_status', models.IntegerField(blank=True, choices=[(0, '跳过'), (1, '成功'), (2, '失败'), (3, '异常')], null=True)),
                ('result_message', models.TextField(blank=True)),
                ('result_error', models.TextField(blank=True)),
                ('case', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Case')),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
            ],
        ),
        migrations.CreateModel(
            name='CaseVsStep',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=0)),
                ('case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Case')),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='case_vs_step_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='case_vs_step_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='Config',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('ui_selenium_client', models.IntegerField(choices=[(0, '不启用'), (1, 'Selenium - 本地'), (2, 'Selenium - 远程')], default=0)),
                ('ui_remote_ip', models.CharField(blank=True, default='', max_length=100)),
                ('ui_remote_port', models.IntegerField(blank=True, null=True)),
                ('ui_driver_type', models.IntegerField(choices=[(1, 'Chrome'), (2, 'IE'), (3, 'FireFox'), (4, 'PhantomJS')], default=1)),
                ('ui_window_size', models.IntegerField(choices=[(1, '最大化'), (2, '自定义')], default=1)),
                ('ui_window_width', models.IntegerField(blank=True, null=True)),
                ('ui_window_height', models.IntegerField(blank=True, null=True)),
                ('ui_driver_ff_profile', models.CharField(blank=True, default='', max_length=100)),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='config_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='config_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('img', models.ImageField(upload_to='img')),
            ],
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('order', models.FloatField(default=0)),
            ],
            options={
                'ordering': ['order'],
            },
        ),
        migrations.CreateModel(
            name='Step',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('timeout', models.FloatField(blank=True, null=True)),
                ('save_as', models.CharField(blank=True, max_length=100)),
                ('ui_by', models.IntegerField(choices=[(0, ''), (1, 'id'), (2, 'xpath'), (3, 'link text'), (4, 'partial link text'), (5, 'name'), (6, 'tag name'), (7, 'class name'), (8, 'css selector'), (9, 'public element'), (10, 'variable')], default=0)),
                ('ui_locator', models.TextField(blank=True)),
                ('ui_index', models.IntegerField(blank=True, null=True)),
                ('ui_base_element', models.CharField(blank=True, max_length=1000)),
                ('ui_data', models.TextField(blank=True)),
                ('ui_special_action', models.IntegerField(choices=[(0, ''), (1, '鼠标 - 单击'), (2, '鼠标 - 点击后不放'), (3, '鼠标 - 右键单击'), (4, '鼠标 - 双击'), (5, '鼠标 - 释放'), (6, '鼠标 - 移动到偏移点位置'), (7, '鼠标 - 移动到某元素中间'), (8, '鼠标 - 移动到某元素左上角为基准的偏移点位置'), (9, '鼠标 - 拖动某元素到另一元素上'), (10, '鼠标 - 拖动某元素到偏移点位置'), (11, '键盘 - 按下某键不释放'), (12, '键盘 - 释放某键'), (13, '键盘 - 发送按键（组）到当前焦点元素'), (14, '键盘 - 发送按键（组）到指定元素')], default=0)),
                ('ui_alert_handle', models.IntegerField(choices=[(1, '确定'), (2, '取消'), (3, '忽略')], default=1)),
                ('api_url', models.TextField(blank=True)),
                ('api_headers', models.TextField(blank=True)),
                ('api_body', models.TextField(blank=True)),
                ('api_data', models.TextField(blank=True)),
                ('other_data', models.TextField(blank=True)),
                ('action', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Action')),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='step_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='step_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('other_sub_case', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='step_sub_case', to='main.Case')),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Project')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='StepResult',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('action', models.CharField(blank=True, max_length=100)),
                ('step_order', models.IntegerField(blank=True, null=True)),
                ('start_date', models.DateTimeField(blank=True, null=True, verbose_name='开始时间')),
                ('end_date', models.DateTimeField(blank=True, null=True, verbose_name='结束时间')),
                ('result_status', models.IntegerField(blank=True, choices=[(0, '跳过'), (1, '成功'), (2, '失败'), (3, '异常')], null=True)),
                ('result_message', models.TextField(blank=True)),
                ('result_error', models.TextField(blank=True)),
                ('snapshot', models.TextField(blank=True, null=True)),
                ('has_sub_case', models.BooleanField(default=False)),
                ('ui_last_url', models.TextField(blank=True)),
                ('case_result', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.CaseResult')),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('imgs', models.ManyToManyField(to='main.Image')),
                ('step', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Step')),
            ],
        ),
        migrations.CreateModel(
            name='Suite',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('timeout', models.FloatField(default=10)),
                ('ui_get_ss', models.BooleanField(default=True)),
                ('log_level', models.IntegerField(choices=[(1, 'DEV'), (10, 'DEBUG'), (20, 'INFO'), (30, 'WARNING'), (40, 'ERROR'), (50, 'CRITICAL')], default=20)),
                ('thread_count', models.IntegerField(default=1)),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='SuiteResult',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('timeout', models.FloatField(default=10)),
                ('ui_get_ss', models.BooleanField(default=True)),
                ('thread_count', models.IntegerField(default=1)),
                ('config', models.TextField(blank=True, null=True)),
                ('variable_group', models.TextField(blank=True, null=True)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('start_date', models.DateTimeField(blank=True, null=True, verbose_name='开始时间')),
                ('end_date', models.DateTimeField(blank=True, null=True, verbose_name='结束时间')),
                ('execute_count', models.IntegerField(blank=True, null=True)),
                ('pass_count', models.IntegerField(blank=True, null=True)),
                ('fail_count', models.IntegerField(blank=True, null=True)),
                ('error_count', models.IntegerField(blank=True, null=True)),
                ('result_status', models.IntegerField(blank=True, choices=[(0, '跳过'), (1, '成功'), (2, '失败'), (3, '异常')], null=True)),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suite_result_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suite_result_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Project')),
                ('suite', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Suite')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='SuiteVsCase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=0)),
                ('case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Case')),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suite_vs_case_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suite_vs_case_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('suite', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Suite')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.CreateModel(
            name='Token',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('value', models.CharField(max_length=100)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='对应用户')),
            ],
        ),
        migrations.CreateModel(
            name='Variable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('value', models.TextField(blank=True)),
                ('order', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='VariableGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid1, editable=False, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('keyword', models.CharField(blank=True, max_length=100)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
                ('modified_date', models.DateTimeField(auto_now=True, null=True, verbose_name='修改时间')),
                ('is_active', models.BooleanField(default=True)),
                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='variable_group_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('modifier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='variable_group_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人')),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Project')),
            ],
            options={
                'ordering': ['-modified_date'],
            },
        ),
        migrations.AddField(
            model_name='variable',
            name='variable_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.VariableGroup'),
        ),
        migrations.AddField(
            model_name='suite',
            name='case',
            field=models.ManyToManyField(through='main.SuiteVsCase', to='main.Case'),
        ),
        migrations.AddField(
            model_name='suite',
            name='config',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Config'),
        ),
        migrations.AddField(
            model_name='suite',
            name='creator',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suite_creator', to=settings.AUTH_USER_MODEL, verbose_name='创建人'),
        ),
        migrations.AddField(
            model_name='suite',
            name='modifier',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suite_modifier', to=settings.AUTH_USER_MODEL, verbose_name='修改人'),
        ),
        migrations.AddField(
            model_name='suite',
            name='project',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Project'),
        ),
        migrations.AddField(
            model_name='suite',
            name='variable_group',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.VariableGroup'),
        ),
        migrations.AddField(
            model_name='casevsstep',
            name='step',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Step'),
        ),
        migrations.AddField(
            model_name='caseresult',
            name='step_result',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.StepResult'),
        ),
        migrations.AddField(
            model_name='caseresult',
            name='suite_result',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.SuiteResult'),
        ),
        migrations.AddField(
            model_name='case',
            name='project',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.Project'),
        ),
        migrations.AddField(
            model_name='case',
            name='step',
            field=models.ManyToManyField(through='main.CaseVsStep', to='main.Step'),
        ),
        migrations.AddField(
            model_name='case',
            name='variable_group',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.VariableGroup'),
        ),
        migrations.AddField(
            model_name='action',
            name='type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.ActionType'),
        ),
        migrations.AlterUniqueTogether(
            name='variable',
            unique_together={('name', 'variable_group')},
        ),
        migrations.AlterUniqueTogether(
            name='token',
            unique_together={('value',)},
        ),
        migrations.AlterUniqueTogether(
            name='suitevscase',
            unique_together={('suite', 'case', 'order')},
        ),
        migrations.AlterUniqueTogether(
            name='casevsstep',
            unique_together={('case', 'step', 'order')},
        ),
        migrations.AlterUniqueTogether(
            name='action',
            unique_together={('name', 'type')},
        ),
    ]
