# Generated by Django 5.0.8 on 2024-09-06 11:28

import django.db.models.deletion
import django.utils.timezone
import eremaea.models
from django.db import migrations, models


class Migration(migrations.Migration):

    replaces = [('eremaea', '0001_initial'), ('eremaea', '0002_drop_index_together')]

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='RetentionPolicy',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=256, unique=True)),
                ('duration', models.DurationField()),
            ],
            options={
                'db_table': 'retention_policy',
            },
        ),
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=256, unique=True)),
                ('default_retention_policy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='eremaea.retentionpolicy')),
            ],
        ),
        migrations.CreateModel(
            name='Snapshot',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(db_index=True, default=django.utils.timezone.now)),
                ('file', models.FileField(max_length=256, upload_to=eremaea.models.snapshot_upload_to)),
                ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eremaea.collection')),
                ('retention_policy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='eremaea.retentionpolicy')),
            ],
            options={
                'ordering': ['-date'],
                'get_latest_by': 'date',
            },
        ),
    ]
