# Generated by Django 3.1.14 on 2022-08-30 01:37

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Device',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(default='', max_length=150, verbose_name='title')),
                ('slug', models.SlugField(help_text='Used to build the URL and as an argument to the loader command.', unique=True, verbose_name='slug')),
                ('created_date', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='created date')),
            ],
            options={
                'verbose_name': 'Device',
                'verbose_name_plural': 'Devices',
                'ordering': ['title'],
            },
        ),
        migrations.CreateModel(
            name='Directory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, default='', max_length=150, verbose_name='title')),
                ('path', models.TextField(default='', help_text='The full path where the directory is stored. There can be only an unique path for the same device.', verbose_name='path')),
                ('created_date', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='created date')),
                ('device', models.ForeignKey(default=None, help_text='The device which holds this directory.', on_delete=django.db.models.deletion.CASCADE, to='django_deovi.device', verbose_name='Related device')),
            ],
            options={
                'verbose_name': 'Directory',
                'verbose_name_plural': 'Directories',
                'ordering': ['title'],
            },
        ),
        migrations.CreateModel(
            name='MediaFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, default='', help_text='Title label', max_length=150, verbose_name='title')),
                ('path', models.TextField(default='', help_text='The full path where the file is stored. There can be only an unique path for the same directory.', verbose_name='path')),
                ('absolute_dir', models.CharField(default='', help_text='The absolute directory path where the file is stored', max_length=150, verbose_name='absolute directory path')),
                ('dirname', models.CharField(blank=True, default='', help_text='The directory name where file is stored.', max_length=200, verbose_name='directory name')),
                ('filename', models.CharField(default='', help_text='The file name', max_length=150, verbose_name='filename')),
                ('container', models.CharField(default='', help_text='The media container as determined from its file extension.', max_length=50, verbose_name='media container')),
                ('filesize', models.BigIntegerField(default=0, help_text='The file size', validators=[django.core.validators.MinValueValidator(0)], verbose_name='filesize')),
                ('stored_date', models.DateTimeField(db_index=True, default=None, verbose_name='stored date')),
                ('loaded_date', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='loaded date')),
                ('directory', models.ForeignKey(default=None, help_text='The directory which holds this file.', on_delete=django.db.models.deletion.CASCADE, to='django_deovi.directory', verbose_name='Related directory')),
            ],
            options={
                'verbose_name': 'MediaFile',
                'verbose_name_plural': 'MediaFiles',
                'ordering': ['stored_date'],
            },
        ),
        migrations.AddConstraint(
            model_name='mediafile',
            constraint=models.UniqueConstraint(fields=('directory', 'path'), name='deovi_mediafile_directory_path'),
        ),
        migrations.AddConstraint(
            model_name='directory',
            constraint=models.UniqueConstraint(fields=('device', 'path'), name='deovi_directory_device_path'),
        ),
    ]
