# Generated by Django 3.0.5 on 2020-04-01 21:18

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import repertoire.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Album',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField()),
                ('mbid', models.CharField(blank=True, max_length=64)),
                ('release', models.DateField(blank=True)),
                ('cover_url', models.CharField(blank=True, max_length=1024)),
                ('cover_file', models.ImageField(blank=True, upload_to='')),
            ],
        ),
        migrations.CreateModel(
            name='Area',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=512)),
                ('mbid', models.CharField(max_length=64)),
                ('type', models.CharField(choices=[('X', 'Country'), ('L', 'Subdivision'), ('C', 'County'), ('M', 'Municipality'), ('S', 'City'), ('D', 'District'), ('I', 'Island')], max_length=2)),
                ('country_code', models.CharField(blank=True, max_length=2, verbose_name='iso-3166-1-code')),
            ],
        ),
        migrations.CreateModel(
            name='Artist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=512)),
                ('mbid', models.CharField(blank=True, max_length=64)),
                ('type', models.CharField(choices=[('P', 'Person'), ('G', 'Group'), ('O', 'Orchestra'), ('C', 'Choir'), ('F', 'Character'), ('O', 'Other')], max_length=1)),
                ('begin', models.DateField(blank=True, verbose_name='Date of persons birth/Date of group formation')),
                ('end', models.DateField(blank=True, verbose_name='Death of person/Group dissolved - blank if still together')),
                ('area', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.PROTECT, to='repertoire.Area')),
            ],
        ),
        migrations.CreateModel(
            name='Playlist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=1024)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Track',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=512)),
                ('mbid', models.CharField(blank=True, max_length=64)),
                ('audio', models.FileField(blank=True, help_text='Allowed type - .mp3, .wav, .ogg', upload_to=repertoire.models.audio_path)),
                ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repertoire.Album')),
                ('artist', models.ManyToManyField(to='repertoire.Artist')),
                ('tags', models.ManyToManyField(to='repertoire.Tag')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='TrackInPlaylist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_number', models.IntegerField()),
                ('playlist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repertoire.Playlist')),
                ('track', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repertoire.Track')),
            ],
        ),
        migrations.AddField(
            model_name='playlist',
            name='tags',
            field=models.ManyToManyField(to='repertoire.Tag'),
        ),
        migrations.AddField(
            model_name='playlist',
            name='tracks',
            field=models.ManyToManyField(through='repertoire.TrackInPlaylist', to='repertoire.Track'),
        ),
        migrations.AddField(
            model_name='playlist',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='artist',
            name='tags',
            field=models.ManyToManyField(to='repertoire.Tag'),
        ),
        migrations.AddField(
            model_name='artist',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='album',
            name='tags',
            field=models.ManyToManyField(to='repertoire.Tag'),
        ),
        migrations.AddField(
            model_name='album',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
    ]
