# Generated by Django 3.0.7 on 2020-06-07 13:04

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='File',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('document', models.FileField(upload_to='documents/')),
                ('name', models.CharField(db_index=True, max_length=100)),
                ('description', models.CharField(blank=True, max_length=255)),
                ('checksum', models.CharField(max_length=150)),
                ('storage_location', models.CharField(max_length=100)),
                ('path', models.CharField(max_length=256)),
                ('origin', models.CharField(max_length=100)),
                ('password', models.CharField(max_length=100)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role_name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=100)),
                ('password', models.CharField(max_length=100)),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.Role')),
            ],
        ),
        migrations.CreateModel(
            name='Url',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('expiry', models.DateTimeField(verbose_name='expiry at')),
                ('download_count', models.IntegerField(default=0)),
                ('url', models.UUIDField(default=uuid.uuid4, editable=False)),
                ('created_at', models.DateTimeField(verbose_name='created at')),
                ('file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.File')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.User')),
            ],
        ),
        migrations.AddField(
            model_name='file',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.User'),
        ),
        migrations.CreateModel(
            name='Access',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('source_ip', models.GenericIPAddressField()),
                ('user_agent', models.CharField(max_length=1000)),
                ('timestamp', models.DateTimeField(verbose_name='timestamp')),
                ('file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.File')),
                ('url', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.Url')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='disty.User')),
            ],
        ),
    ]
