# Generated by Django 5.0.9 on 2025-02-14 09:30

import django.db.models.deletion
import history4feed.app.models
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('name', history4feed.app.models.SlugField(max_length=1000, primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='Feed',
            fields=[
                ('id', models.UUIDField(help_text='UUID of feed generated by history4feed', primary_key=True, serialize=False)),
                ('title', models.CharField(help_text='found in the <channel> of RSS output. Is always kept up to date with the latest feed import values for this property.', max_length=1000)),
                ('description', models.CharField(help_text='found in the <channel> of RSS output. Is always kept up to date with the latest feed import values for this property.', max_length=10240)),
                ('url', models.URLField(help_text='\nThe URL of the RSS or ATOM feed\n\nNote this will be validated to ensure the feed is in the correct format.\n', max_length=1000, unique=True, validators=[history4feed.app.models.normalize_url])),
                ('earliest_item_pubdate', models.DateTimeField(help_text='pubdate of earliest post', null=True)),
                ('latest_item_pubdate', models.DateTimeField(help_text='pubdate of latest post', null=True)),
                ('datetime_added', models.DateTimeField(auto_now_add=True, help_text='date feed entry was added to database')),
                ('feed_type', models.CharField(choices=[('rss', 'Rss'), ('atom', 'Atom'), ('skeleton', 'Skeleton')], editable=False, help_text='type of feed', max_length=12)),
                ('pretty_url', models.URLField(default=None, max_length=1000, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Job',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, help_text='UUID of job', primary_key=True, serialize=False)),
                ('state', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('success', 'Success'), ('failed', 'Failed')], default='pending', help_text='state of the job', max_length=12)),
                ('run_datetime', models.DateTimeField(auto_now_add=True, help_text='time job was executed')),
                ('earliest_item_requested', models.DateTimeField(help_text='shows the earliest time for posts requested. Useful for when jobs are run to see if the time range it runs across is expected', null=True)),
                ('latest_item_requested', models.DateTimeField(help_text='shows the latest time for posts requested', null=True)),
                ('info', models.CharField(help_text='contains a useful summary of the job (e.g. number of posts retrieved, errors logged)', max_length=10240)),
                ('include_remote_blogs', models.BooleanField(default=False)),
                ('feed', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='history4feed.feed')),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.UUIDField(help_text='UUID of items generated by history4feed', primary_key=True, serialize=False)),
                ('datetime_added', models.DateTimeField(auto_now_add=True)),
                ('datetime_updated', models.DateTimeField(auto_now=True)),
                ('title', models.CharField(help_text='found in the <item> element of feed output', max_length=1000)),
                ('description', models.CharField(blank=True, help_text='found in the <item> element of feed output', max_length=2097152)),
                ('link', models.URLField(help_text='link to full article. found in the <item> element of feed output', max_length=1000, validators=[history4feed.app.models.normalize_url])),
                ('pubdate', models.DateTimeField(help_text='date of publication.')),
                ('author', models.CharField(blank=True, help_text='author of the post', max_length=1000, null=True)),
                ('is_full_text', models.BooleanField(default=False, help_text='if full text has been retrieved')),
                ('content_type', models.CharField(default='plain/text', help_text='content type of the description', max_length=200)),
                ('added_manually', models.BooleanField(default=False)),
                ('deleted_manually', models.BooleanField(default=False, help_text='this post is hidden from user')),
                ('categories', models.ManyToManyField(blank=True, help_text='categories of the post', related_name='posts', to='history4feed.category')),
                ('feed', models.ForeignKey(help_text='feed id this item belongs too', on_delete=django.db.models.deletion.CASCADE, related_name='posts', to='history4feed.feed')),
            ],
        ),
        migrations.CreateModel(
            name='FulltextJob',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('retrieved', 'Retrieved'), ('skipped', 'Skipped'), ('failed', 'Failed'), ('retrieving', 'Retrieving')], default='retrieving', max_length=15)),
                ('error_str', models.CharField(blank=True, max_length=1500, null=True)),
                ('link', models.CharField(max_length=1500)),
                ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fulltext_jobs', to='history4feed.job')),
                ('post', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fulltext_jobs', to='history4feed.post')),
            ],
        ),
        migrations.AddConstraint(
            model_name='post',
            constraint=models.UniqueConstraint(fields=('link', 'feed'), name='unique_link_by_feed'),
        ),
    ]
