# Generated by Django 4.0.2 on 2022-02-22 01:25

from django.db import migrations, models
import django.db.models.deletion
import rest.fields
import rest.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('started_at', models.DateTimeField(blank=True, default=None, null=True)),
                ('completed_at', models.DateTimeField(blank=True, default=None, null=True)),
                ('stale_after', models.DateTimeField(blank=True, default=None, null=True)),
                ('scheduled_for', models.DateTimeField(blank=True, db_index=True, default=None, null=True)),
                ('cancel_requested', models.BooleanField(blank=True, default=False)),
                ('state', models.IntegerField(choices=[(0, 'scheduled'), (1, 'started'), (2, 'retry_later'), (10, 'completed'), (-1, 'failed'), (-2, 'canceled')], db_index=True, default=0)),
                ('runtime', models.IntegerField(default=0)),
                ('attempts', models.IntegerField(default=0)),
                ('channel', models.CharField(db_index=True, default='tq_task', max_length=200)),
                ('model', models.CharField(db_index=True, max_length=200)),
                ('fname', models.CharField(blank=True, default=None, max_length=200, null=True)),
                ('data', rest.fields.JSONField(blank=True, default=None, null=True)),
                ('reason', models.CharField(blank=True, default=None, max_length=255, null=True)),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='TaskHook',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('kind', models.CharField(blank=True, max_length=200, null=True)),
                ('data_format', models.CharField(default='json', max_length=32)),
                ('endpoint', models.CharField(blank=True, max_length=200, null=True)),
                ('state', models.IntegerField(choices=[(0, 'inactive'), (1, 'active')], db_index=True, default=1)),
                ('channel', models.CharField(db_index=True, default='tq_hook', max_length=200)),
                ('model', models.CharField(blank=True, db_index=True, max_length=200, null=True)),
                ('group', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='account.group')),
            ],
            bases=(models.Model, rest.models.RestModel, rest.models.MetaDataModel),
        ),
        migrations.CreateModel(
            name='TaskLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('kind', models.CharField(blank=True, default=None, max_length=64, null=True)),
                ('text', models.TextField()),
                ('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='logs', to='taskqueue.task')),
            ],
            bases=(models.Model, rest.models.RestModel),
        ),
        migrations.CreateModel(
            name='TaskHookMetaData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(blank=True, db_index=True, default=None, max_length=32, null=True)),
                ('key', models.CharField(db_index=True, max_length=80)),
                ('value_format', models.CharField(max_length=16)),
                ('value', models.TextField()),
                ('int_value', models.IntegerField(blank=True, default=None, null=True)),
                ('float_value', models.IntegerField(blank=True, default=None, null=True)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='properties', to='taskqueue.taskhook')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
