# Generated by Django 2.2.2 on 2019-07-17 19:46

import capdb.models
import capdb.versioning
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models


class Migration(migrations.Migration):

    dependencies = [
        ('capdb', '0070_auto_20190709_1712'),
    ]

    operations = [
        migrations.CreateModel(
            name='EditLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('user_id', models.IntegerField(blank=True, null=True)),
                ('description', models.TextField()),
            ],
        ),
        migrations.AddField(
            model_name='casemetadata',
            name='duplicate',
            field=models.BooleanField(default=False, help_text='True if case was processed but is a duplicate of another preferred case'),
        ),
        migrations.AddField(
            model_name='casemetadata',
            name='duplicate_of',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='duplicates', to='capdb.CaseMetadata'),
        ),
        migrations.AddField(
            model_name='casemetadata',
            name='in_scope',
            field=models.BooleanField(default=True, help_text='True if case should be included in public data'),
        ),
        migrations.AddField(
            model_name='reporter',
            name='sys_period',
            field=capdb.versioning.DefaultDateTimeRangeField(),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='volumemetadata',
            name='duplicate_of',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='duplicates', to='capdb.VolumeMetadata'),
        ),
        migrations.AddField(
            model_name='volumemetadata',
            name='sys_period',
            field=capdb.versioning.DefaultDateTimeRangeField(),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='volumemetadata',
            name='task_statuses',
            field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, help_text='Date and results of tasks run for this volume'),
        ),
        migrations.AlterField(
            model_name='casemetadata',
            name='duplicative',
            field=models.BooleanField(default=False, help_text='True if case was not processed because it is an unofficial case in a regional reporter'),
        ),
        migrations.CreateModel(
            name='HistoricalVolumeMetadata',
            fields=[
                ('barcode', models.CharField(db_index=True, max_length=64)),
                ('volume_number', models.CharField(blank=True, max_length=64, null=True)),
                ('nominative_volume_number', models.CharField(blank=True, max_length=1024, null=True)),
                ('hollis_number', models.CharField(help_text='Identifier in the Harvard cataloging system, HOLLIS', max_length=9, null=True)),
                ('publisher', models.CharField(blank=True, max_length=255, null=True)),
                ('publication_year', models.IntegerField(blank=True, null=True)),
                ('nominative_name', models.CharField(blank=True, max_length=1024, null=True)),
                ('series_volume_number', models.CharField(blank=True, max_length=1024, null=True)),
                ('spine_start_year', models.IntegerField(blank=True, null=True)),
                ('spine_end_year', models.IntegerField(blank=True, null=True)),
                ('start_year', models.IntegerField(blank=True, null=True)),
                ('end_year', models.IntegerField(blank=True, null=True)),
                ('page_start_year', models.IntegerField(blank=True, null=True)),
                ('page_end_year', models.IntegerField(blank=True, null=True)),
                ('contributing_library', models.CharField(blank=True, help_text="Several volumes didn't come from our collection", max_length=256, null=True)),
                ('rare', models.BooleanField(default=False)),
                ('hsc_review', models.CharField(blank=True, choices=[('No', 'No'), ('Complete', 'Complete'), ('Yes', 'Yes'), ('Reclassed', 'Reclassed')], help_text='Historical and Special Collections Review', max_length=9, null=True)),
                ('needs_repair', models.CharField(blank=True, choices=[('No', 'No'), ('Complete', 'Complete'), ('Yes', 'Yes')], max_length=9, null=True)),
                ('missing_text_pages', models.TextField(blank=True, help_text='Pages damaged enough to have lost text.', null=True)),
                ('bibliographic_review', models.CharField(blank=True, choices=[('No', 'No'), ('Complete', 'Complete'), ('Yes', 'Yes')], max_length=7, null=True)),
                ('analyst_page_count', models.IntegerField(blank=True, help_text='The page number of the last numbered page in the book', null=True)),
                ('duplicate', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(blank=True, editable=False)),
                ('updated_at', models.DateTimeField(blank=True, null=True)),
                ('replaced_pages', models.CharField(blank=True, help_text='List of pages that were replaced', max_length=1024, null=True)),
                ('has_marginalia', models.BooleanField(default=False)),
                ('publication_city', models.CharField(blank=True, max_length=1024, null=True)),
                ('title', models.CharField(blank=True, max_length=1024, null=True)),
                ('hand_feed', models.BooleanField(default=False, help_text='Instructions for operator, not whether or not it happened')),
                ('image_count', models.IntegerField(blank=True, help_text='Count of images recieved from scanner', null=True)),
                ('publisher_deleted_pages', models.BooleanField(default=False)),
                ('notes', models.CharField(blank=True, max_length=512, null=True)),
                ('original_barcode', models.CharField(blank=True, max_length=64, null=True)),
                ('scope_reason', models.CharField(blank=True, choices=[('Damaged', 'Damaged'), ('Not Official', 'Not Official'), ('Duplicate', 'Duplicate'), ('No Cases', 'No Cases')], help_text='The reason something would be out_of_scope', max_length=16, null=True)),
                ('out_of_scope', models.BooleanField(default=False)),
                ('meyer_box_barcode', models.CharField(blank=True, help_text='The Meyer box barcode', max_length=32, null=True)),
                ('uv_box_barcode', models.CharField(blank=True, help_text='The Underground Vaults box barcode', max_length=32, null=True)),
                ('meyer_ky_truck', models.CharField(blank=True, help_text='The Meyer truck to Kentucky this book was shipped on', max_length=32, null=True)),
                ('meyer_pallet', models.CharField(blank=True, help_text='The pallet Meyer stored the book on', max_length=32, null=True)),
                ('ingest_status', models.CharField(choices=[('to_ingest', 'to_ingest'), ('ingested', 'ingested'), ('error', 'error'), ('skip', 'skip')], default='to_ingest', max_length=10)),
                ('ingest_errors', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('xml_checksums_need_update', models.BooleanField(default=False, help_text='Whether checksums in volume_xml match current values in related case_xml and page_xml data.')),
                ('xml_start_year', models.IntegerField(blank=True, null=True)),
                ('xml_end_year', models.IntegerField(blank=True, null=True)),
                ('xml_publication_year', models.IntegerField(blank=True, null=True)),
                ('xml_publisher', models.CharField(blank=True, max_length=255, null=True)),
                ('xml_publication_city', models.CharField(blank=True, max_length=1024, null=True)),
                ('xml_volume_number', models.CharField(blank=True, max_length=64, null=True)),
                ('xml_reporter_short_name', models.CharField(blank=True, max_length=255, null=True)),
                ('xml_reporter_full_name', models.CharField(blank=True, max_length=255, null=True)),
                ('xml_metadata', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('last_es_index', models.DateTimeField(blank=True, help_text='Last time cases for this volume were successfully indexed by ElasticSearch', null=True)),
                ('task_statuses', django.contrib.postgres.fields.jsonb.JSONField(default=dict, help_text='Date and results of tasks run for this volume')),
                ('sys_period', capdb.versioning.DefaultDateTimeRangeField()),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('created_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='capdb.TrackingToolUser')),
                ('duplicate_of', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='capdb.VolumeMetadata')),
                ('nominative_reporter', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='capdb.Reporter')),
                ('reporter', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='capdb.Reporter')),
                ('request', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='capdb.BookRequest')),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical volume metadata',
                'ordering': ('-sys_period', '-history_id'),
                'db_table': 'capdb_volumemetadata_history',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalReporter',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('full_name', models.CharField(db_index=True, max_length=1024)),
                ('short_name', models.CharField(max_length=64)),
                ('short_name_slug', models.CharField(blank=True, db_index=True, max_length=64, null=True)),
                ('start_year', models.IntegerField(blank=True, null=True)),
                ('end_year', models.IntegerField(blank=True, null=True)),
                ('volume_count', models.IntegerField(blank=True, null=True)),
                ('created_at', models.DateTimeField()),
                ('updated_at', models.DateTimeField()),
                ('notes', models.TextField(blank=True, null=True)),
                ('hollis', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=9), blank=True, help_text='This is going to replace the Hollis model', size=None)),
                ('is_nominative', models.BooleanField(default=False)),
                ('sys_period', capdb.versioning.DefaultDateTimeRangeField()),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('nominative_for', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='capdb.Reporter')),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical reporter',
                'ordering': ('-sys_period', '-history_id'),
                'db_table': 'capdb_reporter_history',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='EditLogTransaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('timestamp', capdb.models.TransactionTimestampDateTimeField()),
                ('edit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='capdb.EditLog')),
            ],
        ),
    ]
