<filename>oaipmh/migrations/0001_initial.py<gh_stars>1-10
# Generated by Django 2.1.3 on 2018-11-26 10:22

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='MetadataFormat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.CharField(help_text="Name of format. Also known as the 'metadata prefix'", max_length=1024)),
                ('namespace', models.CharField(help_text='XML namespace of format', max_length=1024)),
                ('schema', models.URLField(help_text='XML schema of format')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Last update time')),
            ],
        ),
        migrations.CreateModel(
            name='Record',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.CharField(help_text='Unique identifier for this record within the repository', max_length=1024)),
                ('datestamp', models.DateTimeField(help_text='Datestamp of record as returned from repository')),
                ('xml', models.TextField(help_text='Raw record XML as returned by repository')),
                ('harvested_at', models.DateTimeField(help_text='When this record was last harvested from the repository')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Last update time')),
                ('metadata_format', models.ForeignKey(help_text='Metadata prefix for this record', on_delete=django.db.models.deletion.CASCADE, related_name='records', to='oaipmh.MetadataFormat')),
            ],
        ),
        migrations.CreateModel(
            name='Repository',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.URLField(help_text='Endpoint URL for repository')),
                ('basic_auth_user', models.CharField(blank=True, help_text='Username for basic auth. If blank, no basic auth is performed.', max_length=255)),
                ('basic_auth_password', models.CharField(blank=True, help_text='Password for basic auth. Only used if basic_auth_user is not blank.', max_length=255)),
                ('last_harvested_at', models.DateTimeField(blank=True, default=None, help_text='Date and time the last harvest was performed.', null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Creation time')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Last update time')),
            ],
            options={
                'verbose_name_plural': 'Repositories',
            },
        ),
        migrations.AddField(
            model_name='metadataformat',
            name='repository',
            field=models.ForeignKey(help_text='Repository these metadata formats apply to', on_delete=django.db.models.deletion.CASCADE, related_name='metadata_formats', to='oaipmh.Repository'),
        ),
        migrations.AlterUniqueTogether(
            name='record',
            unique_together={('identifier', 'metadata_format', 'datestamp')},
        ),
        migrations.AlterUniqueTogether(
            name='metadataformat',
            unique_together={('repository', 'identifier')},
        ),
    ]
