<filename>content/migrations/0001_initial.py
# Generated by Django 3.0 on 2020-01-06 16:21

import content.model_exts
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Album',
            fields=[
                ('id', models.CharField(default=uuid.uuid4, editable=False, max_length=255, primary_key=True, serialize=False)),
                ('uri', models.CharField(default=uuid.uuid4, editable=False, max_length=255, unique=True)),
                ('name', models.CharField(max_length=255)),
                ('type', models.CharField(blank=True, max_length=255, null=True)),
                ('image', models.FileField(blank=True, null=True, upload_to=content.model_exts.rename_image)),
                ('image_ref', models.CharField(blank=True, default=None, max_length=255, null=True)),
                ('platform', models.CharField(max_length=255)),
                ('uploaded_date', models.DateField(auto_now_add=True, null=True)),
                ('last_changed', models.DateField(auto_now=True, null=True)),
                ('date_published', models.DateField(blank=True, default=django.utils.timezone.now, null=True)),
                ('is_displayed', models.BooleanField(blank=True, default=True)),
                ('is_deleted', models.BooleanField(blank=True, default=False)),
            ],
            options={
                'verbose_name': 'album',
                'verbose_name_plural': 'albums',
            },
        ),
        migrations.CreateModel(
            name='Artist',
            fields=[
                ('id', models.CharField(default=uuid.uuid4, editable=False, max_length=255, primary_key=True, serialize=False)),
                ('uri', models.CharField(default=uuid.uuid4, editable=False, max_length=255, unique=True)),
                ('name', models.CharField(max_length=255)),
                ('image', models.FileField(blank=True, null=True, upload_to=content.model_exts.rename_image)),
                ('image_reference', models.CharField(blank=True, default=None, max_length=255, null=True)),
                ('platform', models.CharField(max_length=255)),
                ('date_joined', models.DateTimeField(auto_now_add=True, null=True)),
            ],
            options={
                'verbose_name': 'artist',
                'verbose_name_plural': 'artists',
            },
        ),
        migrations.CreateModel(
            name='Song',
            fields=[
                ('id', models.CharField(default=uuid.uuid4, editable=False, max_length=255, primary_key=True, serialize=False)),
                ('uri', models.CharField(default=uuid.uuid4, editable=False, max_length=255, unique=True, verbose_name='URI')),
                ('file', models.FileField(blank=True, null=True, upload_to=content.model_exts.rename_song, verbose_name='Song')),
                ('title', models.CharField(max_length=255, verbose_name='Name')),
                ('duration', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True, verbose_name='Duration')),
                ('genre', models.CharField(blank=True, max_length=255, null=True)),
                ('platform', models.CharField(max_length=255, null=True)),
                ('is_explicit', models.BooleanField(blank=True, default=False)),
                ('is_displayed', models.BooleanField(blank=True, default=True)),
                ('is_deleted', models.BooleanField(blank=True, default=False)),
                ('last_changed', models.DateField(auto_now=True, null=True)),
                ('uploaded_date', models.DateField(auto_now_add=True, null=True)),
                ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='content.Album')),
            ],
            options={
                'verbose_name': 'song',
                'verbose_name_plural': 'songs',
            },
        ),
        migrations.CreateModel(
            name='SongContributor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('contribution_type', models.CharField(max_length=255, null=True)),
                ('pending', models.BooleanField(blank=True, default=False)),
                ('approved', models.BooleanField(blank=True, default=True)),
                ('date_added', models.DateField(auto_now_add=True, null=True)),
                ('last_changed', models.DateField(auto_now=True, null=True)),
                ('primary_artist', models.BooleanField(blank=True, default=False)),
                ('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='artist_to_song', to='content.Artist')),
                ('song', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='song_to_artist', to='content.Song')),
            ],
            options={
                'verbose_name': 'song contributor',
                'verbose_name_plural': 'song contributors',
            },
        ),
        migrations.AddField(
            model_name='song',
            name='contributors',
            field=models.ManyToManyField(related_name='song_contributors', through='content.SongContributor', to='content.Artist'),
        ),
        migrations.AddField(
            model_name='song',
            name='uploaded_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='song_uploaded_by', to='content.Artist'),
        ),
        migrations.CreateModel(
            name='AlbumContributor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('contribution_type', models.CharField(max_length=255, null=True)),
                ('pending', models.BooleanField(blank=True, default=False)),
                ('approved', models.BooleanField(blank=True, default=True)),
                ('date_added', models.DateField(auto_now_add=True, null=True)),
                ('last_changed', models.DateField(auto_now=True, null=True)),
                ('primary_artist', models.BooleanField(blank=True, default=False)),
                ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='album_to_artist', to='content.Album')),
                ('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='artist_to_album', to='content.Artist')),
            ],
            options={
                'verbose_name': 'album contributor',
                'verbose_name_plural': 'album contributors',
            },
        ),
        migrations.AddField(
            model_name='album',
            name='contributors',
            field=models.ManyToManyField(through='content.AlbumContributor', to='content.Artist'),
        ),
        migrations.AddField(
            model_name='album',
            name='uploaded_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='album_uploaded_by', to='content.Artist'),
        ),
    ]
