# Generated by Django 3.0.1 on 2019-12-27 00:42

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Owner',
            fields=[
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('type', models.CharField(choices=[('u', 'user'), ('o', 'org')], max_length=4)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.OneToOneField(db_column='id', on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='core.Owner')),
                ('username', models.CharField(max_length=45, unique=True)),
                ('fullname', models.CharField(max_length=45)),
                ('date_of_birth', models.DateField()),
                ('email', models.CharField(max_length=45, unique=True)),
                ('created_at', models.DateTimeField()),
            ],
        ),
        migrations.CreateModel(
            name='Repo',
            fields=[
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=45)),
                ('stars', models.IntegerField()),
                ('forks', models.IntegerField()),
                ('is_public', models.BooleanField()),
                ('created_at', models.DateTimeField()),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Owner')),
            ],
            options={
                'unique_together': {('name', 'owner')},
            },
        ),
        migrations.CreateModel(
            name='Commit',
            fields=[
                ('hash', models.CharField(max_length=45, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField()),
                ('branch', models.CharField(max_length=45)),
                ('repo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Repo')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='core.User')),
            ],
            options={
                'unique_together': {('hash', 'repo')},
            },
        ),
        migrations.CreateModel(
            name='Org',
            fields=[
                ('id', models.OneToOneField(db_column='id', on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='core.Owner')),
                ('description', models.TextField(blank=True, null=True)),
                ('name', models.CharField(max_length=45, unique=True)),
                ('created_at', models.DateTimeField()),
                ('owners', models.ManyToManyField(to='core.User')),
            ],
        ),
        migrations.CreateModel(
            name='LanguageRepo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('language', models.CharField(max_length=45)),
                ('lines_of_code', models.IntegerField()),
                ('repo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Repo')),
            ],
            options={
                'unique_together': {('language', 'repo')},
            },
        ),
        migrations.CreateModel(
            name='CommitFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('filename', models.CharField(max_length=45)),
                ('action', models.CharField(choices=[('c', 'create'), ('u', 'update'), ('r', 'rename'), ('d', 'delete'), ('h', 'help'), ('o', 'other')], max_length=6)),
                ('commit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Commit')),
            ],
            options={
                'unique_together': {('commit', 'filename')},
            },
        ),
        migrations.CreateModel(
            name='Team',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('created_at', models.DateTimeField()),
                ('description', models.TextField(blank=True, null=True)),
                ('members', models.ManyToManyField(to='core.User')),
                ('org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Org')),
            ],
            options={
                'unique_together': {('org', 'name')},
            },
        ),
        migrations.CreateModel(
            name='Issue',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=45)),
                ('description', models.TextField()),
                ('state', models.CharField(choices=[('o', 'open'), ('c', 'closed')], max_length=6)),
                ('created_at', models.DateTimeField()),
                ('label', models.CharField(choices=[('b', 'bug'), ('f', 'feature'), ('d', 'documentation'), ('h', 'help'), ('o', 'other')], max_length=13)),
                ('repo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Repo')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='core.User')),
            ],
            options={
                'unique_together': {('repo', 'title')},
            },
        ),
    ]
