# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-02 09:52
from __future__ import unicode_literals

import autoslug.fields
import django.db.models.deletion
import django.utils.timezone
import markdownx.models
import model_utils.fields
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('user_manager', '0001_initial'),
        ('docs_manager', '0001_initial'),
        ('git_manager', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            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(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='marketplace.Category')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Language',
            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')),
                ('language', models.CharField(max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Package',
            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(max_length=255, unique=True)),
                ('description', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PackageResource',
            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')),
                ('resource', markdownx.models.MarkdownxField()),
                ('url', models.URLField(null=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user_manager.WorkbenchUser')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PackageVersion',
            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')),
                ('version_nr', models.CharField(max_length=50)),
                ('changelog', models.TextField()),
                ('pre_release', models.BooleanField(default=False)),
                ('url', models.URLField(null=True)),
                ('added_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='user_manager.WorkbenchUser')),
            ],
        ),
        migrations.CreateModel(
            name='ExternalPackage',
            fields=[
                ('package_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='marketplace.Package')),
                ('project_page', models.URLField()),
            ],
            options={
                'abstract': False,
            },
            bases=('marketplace.package',),
        ),
        migrations.CreateModel(
            name='InternalPackage',
            fields=[
                ('package_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='marketplace.Package')),
                ('published', models.BooleanField(default=False)),
                ('docs', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='docs_manager.Docs')),
                ('git_repo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='git_manager.GitRepository')),
            ],
            options={
                'abstract': False,
            },
            bases=('marketplace.package',),
        ),
        migrations.AddField(
            model_name='packageversion',
            name='package',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketplace.Package'),
        ),
        migrations.AddField(
            model_name='packageresource',
            name='package',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketplace.Package'),
        ),
        migrations.AddField(
            model_name='package',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketplace.Category'),
        ),
        migrations.AddField(
            model_name='package',
            name='language',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketplace.Language'),
        ),
        migrations.AddField(
            model_name='package',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owner', to='user_manager.WorkbenchUser'),
        ),
        migrations.AddField(
            model_name='package',
            name='subscribed_users',
            field=models.ManyToManyField(to='user_manager.WorkbenchUser'),
        ),
        migrations.AlterUniqueTogether(
            name='packageversion',
            unique_together=set([('package', 'version_nr')]),
        ),
    ]
