# Generated by Django 2.1.3 on 2018-11-11 00:27

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='CrawledItem',
            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')),
                ('lead_image', models.ImageField(editable=False, null=True, upload_to='')),
                ('title', models.TextField(editable=False, null=True)),
                ('original_content', models.TextField(editable=False, null=True)),
                ('extracted_content', models.TextField(editable=False, null=True)),
                ('extraction_score', models.FloatField(default=0)),
                ('spider_name', models.CharField(db_index=True, max_length=512)),
            ],
        ),
        migrations.CreateModel(
            name='Link',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.URLField(editable=False, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Site',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('domain', models.URLField(editable=False, unique=True)),
                ('favicon', models.ImageField(blank=True, null=True, upload_to='favicons')),
                ('crawling_frequency', models.PositiveIntegerField(choices=[(30, 'half_minute'), (60, 'minute'), (900, 'quarter_hourly'), (3600, 'hourly')], default=30)),
            ],
        ),
        migrations.CreateModel(
            name='UserLink',
            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')),
                ('link', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='boris.Link')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='link',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='boris.Site'),
        ),
        migrations.AddField(
            model_name='crawleditem',
            name='link',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='boris.Link'),
        ),
        migrations.AlterUniqueTogether(
            name='userlink',
            unique_together={('link', 'user')},
        ),
        migrations.AlterUniqueTogether(
            name='crawleditem',
            unique_together={('link', 'spider_name')},
        ),
    ]
