# Generated by Django 2.0.5 on 2018-05-23 10:40

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        ('web', '0009_userprofile_department'),
    ]

    operations = [
        migrations.CreateModel(
            name='TaskLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_time', models.DateTimeField(auto_now_add=True)),
                ('end_time', models.DateTimeField(blank=True, null=True)),
                ('task_type', models.CharField(choices=[('cmd', 'CMD'), ('file_send', '批量发送文件'), ('file_get', '批量下载文件')], max_length=64)),
                ('file_dir', models.CharField(blank=True, max_length=64, null=True, verbose_name='文件上传')),
                ('cmd', models.TextField()),
                ('expire_time', models.IntegerField(default=30)),
                ('task_pid', models.IntegerField(default=0)),
                ('note', models.CharField(blank=True, max_length=100, null=True)),
                ('hosts', models.ManyToManyField(to='web.BindHosts')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '批量任务',
                'verbose_name_plural': '批量任务',
            },
        ),
        migrations.CreateModel(
            name='TaskLogDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('event_log', models.TextField()),
                ('result', models.CharField(choices=[('success', 'Success'), ('failed', 'Failed'), ('unknown', 'Unknown')], default='unknown', max_length=30)),
                ('note', models.CharField(blank=True, max_length=100)),
                ('bind_host', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='web.BindHosts')),
                ('child_of_task', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='web.TaskLog')),
            ],
            options={
                'verbose_name': '批量任务日志',
                'verbose_name_plural': '批量任务日志',
            },
        ),
        migrations.CreateModel(
            name='Token',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('token', models.CharField(max_length=64)),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('expire', models.IntegerField(default=300)),
                ('host', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='web.BindHosts')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '任务',
                'verbose_name_plural': '任务',
            },
        ),
    ]
