# Generated by Django 3.1.1 on 2021-03-19 05:02

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='ArticleSpider',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_finished', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='Crawler',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.URLField()),
                ('article_id', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='CrawlerItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('article_id', models.CharField(max_length=255)),
                ('article_url', models.URLField()),
                ('download_latency', models.FloatField(blank=True, null=True)),
                ('collection_name', models.CharField(max_length=255)),
                ('article_status', models.CharField(max_length=100)),
                ('article_error_status', models.CharField(blank=True, max_length=100, null=True)),
                ('http_error', models.IntegerField(default=0)),
                ('dns_error', models.IntegerField(default=0)),
                ('timeout_error', models.IntegerField(default=0)),
                ('base_error', models.IntegerField(default=0)),
                ('skip_url', models.IntegerField(default=0)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='CrawlerSet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_finished', models.BooleanField(default=False)),
                ('crawlers', models.ManyToManyField(to='scraper.CrawlerItem')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='SpiderCrawler',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_finished', models.BooleanField(default=False)),
                ('crawlers', models.ManyToManyField(to='scraper.Crawler')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Scraper',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data', models.IntegerField(default=0)),
                ('workers', models.IntegerField(default=0)),
                ('info_log', models.TextField(blank=True, null=True)),
                ('debug_log', models.TextField(blank=True, null=True)),
                ('error_log', models.TextField(blank=True, null=True)),
                ('is_finished', models.BooleanField(default=False)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('crawler_set', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='scraper.crawlerset')),
                ('spiders', models.ManyToManyField(to='scraper.ArticleSpider')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='articlespider',
            name='thread_crawlers',
            field=models.ManyToManyField(to='scraper.SpiderCrawler'),
        ),
        migrations.AddField(
            model_name='articlespider',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
    ]
