# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-02 22:16
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Error',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message', models.TextField(blank=True, max_length=250, null=True)),
                ('identifier', models.CharField(choices=[('HTTPError', 'HTTP Error'), ('MissingOrInvalidSchemaError', 'Missing or Invalid Schema Error'), ('ConnectionError', 'Connection Error'), ('NotAFeedError', 'Not A Feed Error'), ('NotAnRSSFeedError', 'Not An RSS Feed Error'), ('SiteHasNoFeedsError', 'Site Has No Feeds Error')], max_length=50)),
                ('created_on', models.DateTimeField(default=django.utils.timezone.now)),
            ],
        ),
        migrations.CreateModel(
            name='Feed',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('feed_url', models.URLField(unique=True, verbose_name='Feed URL')),
                ('title', models.CharField(blank=True, max_length=250, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('link', models.URLField(blank=True, null=True)),
                ('last_updated', models.DateTimeField(editable=False, null=True)),
                ('image', models.URLField(blank=True, null=True, verbose_name='Image URL')),
                ('cloud', models.URLField(blank=True, null=True, verbose_name='Cloud URL')),
                ('cached_content', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Keyword',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('word', models.CharField(blank=True, max_length=250, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Site',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('link', models.URLField(blank=True, null=True, unique=True)),
                ('created_on', models.DateTimeField(default=django.utils.timezone.now)),
                ('error', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='site', to='feeds.Error')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='submitted_sites', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('slug', models.SlugField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=250, unique=True)),
            ],
        ),
        migrations.AddField(
            model_name='site',
            name='tags',
            field=models.ManyToManyField(related_name='sites', to='feeds.Tag'),
        ),
        migrations.AddField(
            model_name='keyword',
            name='tag',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='feeds.Tag'),
        ),
        migrations.AddField(
            model_name='feed',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='feeds', to='feeds.Site'),
        ),
        migrations.AlterUniqueTogether(
            name='keyword',
            unique_together=set([('word', 'tag')]),
        ),
        migrations.AlterUniqueTogether(
            name='feed',
            unique_together=set([('site', 'feed_url')]),
        ),
    ]
