# Generated by Django 2.2.1 on 2019-05-02 18:41

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

import hashid_field.field
import model_utils.fields


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name="Module",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                (
                    "path",
                    models.CharField(
                        help_text="Project root-relative filesystem path to test module.",
                        max_length=511,
                        verbose_name="Module Path",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="Project",
            fields=[
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                (
                    "id",
                    hashid_field.field.HashidAutoField(
                        alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
                        min_length=7,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("name", models.CharField(max_length=255, verbose_name="Project Name")),
                ("repo_url", models.URLField(verbose_name="Repository URL")),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="Version",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                (
                    "hash",
                    models.CharField(
                        help_text="Git commit hash as hexadecimal.", max_length=63, verbose_name="Commit Hash"
                    ),
                ),
                ("author", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="Test",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                ("name", models.CharField(help_text="Name of test routine.", max_length=511, verbose_name="Test Name")),
                ("module", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="projects.Module")),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="Target",
            fields=[
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                (
                    "id",
                    hashid_field.field.HashidAutoField(
                        alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
                        min_length=7,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("name", models.CharField(max_length=255, verbose_name="Target Name")),
                ("python_major_version", models.PositiveIntegerField(default=3)),
                ("python_minor_version", models.PositiveIntegerField(default=7)),
                ("python_patch_version", models.PositiveIntegerField(default=3)),
                (
                    "additional_details",
                    models.TextField(
                        blank=True,
                        help_text="Any further information to differentiate this target from others. (Ex. Django==2.0)",
                        null=True,
                    ),
                ),
                ("project", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="projects.Project")),
            ],
            options={"abstract": False},
        ),
        migrations.AddField(
            model_name="module",
            name="project",
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="projects.Project"),
        ),
    ]
