# Generated by Django 2.2 on 2019-04-18 10:01

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Attachment',
            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, verbose_name='created')),
                ('updated', models.DateTimeField(auto_now=True, db_index=True, verbose_name='updated')),
                ('file', models.FileField(upload_to=proplan.models.upload_attach, verbose_name='file')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='proplan_attaches', to=settings.AUTH_USER_MODEL, verbose_name='user')),
            ],
            options={
                'verbose_name': 'attach',
                'ordering': ('-updated', '-created'),
                'verbose_name_plural': 'attaches',
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='updated')),
                ('message', models.TextField(db_index=True, verbose_name='message body')),
                ('changes', models.TextField(blank=True, editable=False, verbose_name='thread changes')),
                ('attachments', models.ManyToManyField(blank=True, to='proplan.Attachment', verbose_name='attachments')),
            ],
            options={
                'verbose_name': 'comment',
                'ordering': ('-updated', '-created'),
                'verbose_name_plural': 'comments',
            },
        ),
        migrations.CreateModel(
            name='Stage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=10, verbose_name='name')),
                ('description', models.TextField(blank=True, verbose_name='description')),
                ('is_finished', models.BooleanField(default=False, verbose_name='is finished')),
                ('is_abs', models.BooleanField(default=False, help_text='Only one record can be used for new stage for Automatic Bug System.', verbose_name='for automatic bug system')),
            ],
            options={
                'verbose_name': 'stage',
                'ordering': ('id',),
                'verbose_name_plural': 'stages',
            },
        ),
        migrations.CreateModel(
            name='Tracker',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=10, verbose_name='name')),
                ('description', models.TextField(blank=True, verbose_name='description')),
                ('is_abs', models.BooleanField(default=False, help_text='Only one record can be used for Automatic Bug System.', verbose_name='for automatic bug system')),
            ],
            options={
                'verbose_name': 'tracker',
                'ordering': ('id',),
                'verbose_name_plural': 'trackers',
            },
        ),
        migrations.CreateModel(
            name='Thread',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='updated')),
                ('priority', models.SmallIntegerField(choices=[(1, 'low'), (2, 'normal'), (3, 'high'), (4, 'urgent'), (5, 'immediate')], db_index=True, default=1, verbose_name='priority')),
                ('is_abs', models.BooleanField(db_index=True, default=False, verbose_name='from automatic bug system')),
                ('title', models.CharField(db_index=True, max_length=255, verbose_name='title')),
                ('message', models.TextField(blank=True, db_index=True, verbose_name='message body')),
                ('attachments', models.ManyToManyField(blank=True, to='proplan.Attachment', verbose_name='attachments')),
                ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='proplan_author_threads', to=settings.AUTH_USER_MODEL, verbose_name='author')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='proplan.Thread', verbose_name='parent thread')),
                ('stage', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='proplan.Stage', verbose_name='stage')),
                ('tracker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='proplan.Tracker', verbose_name='tracker')),
            ],
            options={
                'verbose_name': 'thread',
                'ordering': ('-updated', '-created'),
                'verbose_name_plural': 'threads',
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=50, verbose_name='name')),
                ('description', models.TextField(blank=True, verbose_name='description')),
                ('permissions', models.ManyToManyField(blank=True, limit_choices_to={'content_type__app_label': 'proplan'}, related_name='proplan_roles', to='auth.Permission', verbose_name='permissions')),
                ('users', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='users')),
            ],
            options={
                'verbose_name': 'user role',
                'ordering': ('name',),
                'verbose_name_plural': 'user roles',
            },
        ),
        migrations.CreateModel(
            name='Executor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='updated')),
                ('start', models.DateTimeField(blank=True, db_index=True, editable=False, null=True, verbose_name='start working')),
                ('stop', models.DateTimeField(blank=True, db_index=True, editable=False, null=True, verbose_name='stop working')),
                ('sprint', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='start of the sprint')),
                ('time_sprints', models.IntegerField(db_index=True, default=0, editable=False, verbose_name='time of the sprints')),
                ('comments', models.ManyToManyField(blank=True, to='proplan.Comment', verbose_name='comments')),
                ('role', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='executors', to='proplan.Role', verbose_name='user role')),
                ('thread', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='executors', to='proplan.Thread', verbose_name='thread')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='proplan_executors', to=settings.AUTH_USER_MODEL, verbose_name='user')),
            ],
            options={
                'ordering': ('-updated', '-created'),
                'verbose_name_plural': 'executors',
                'verbose_name': 'executor',
                'permissions': (('start_other_executor', 'Can start other executor'), ('stop_other_executor', 'Can stop other executor')),
            },
        ),
        migrations.AddField(
            model_name='comment',
            name='thread',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='proplan.Thread', verbose_name='thread'),
        ),
        migrations.AddField(
            model_name='comment',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='proplan_comments', to=settings.AUTH_USER_MODEL, verbose_name='user'),
        ),
    ]
