# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-16 08:33
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import music.fields


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.CharField(max_length=30)),
                ('description', models.TextField(blank=True, max_length=500)),
                ('cover', models.ImageField(blank=True, upload_to='images/album_cover/%Y/%m/%d')),
                ('created', models.DateField(auto_now_add=True, db_index=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='albums', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-created',),
            },
        ),
        migrations.CreateModel(
            name='LikeShip',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateField(auto_now_add=True, db_index=True)),
            ],
        ),
        migrations.CreateModel(
            name='Song',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order', music.fields.OrderField(blank=True, db_index=True)),
                ('file', models.FileField(upload_to='songs/%Y/%m/%d/')),
                ('length', models.CharField(max_length=8)),
                ('cover', models.ImageField(blank=True, upload_to='images/song_cover/%Y/%m/%d')),
                ('name', models.CharField(max_length=30)),
                ('description', models.TextField(blank=True)),
                ('genre', models.IntegerField(choices=[(0, '未分類曲風'), (1, 'Hip hop/ Rap'), (2, 'Rock'), (3, 'R&B/ Soul'), (4, 'Singer/ Songwriter')], default=0)),
                ('authorization', models.IntegerField(choices=[(0, '版權所有'), (1, '姓名標示'), (2, '姓名標示-非商業性')], default=0)),
                ('published', models.BooleanField(choices=[(True, '公開'), (False, '隱藏')], default=True)),
                ('lyrics', models.TextField(blank=True)),
                ('created', models.DateField(auto_now_add=True, db_index=True)),
                ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='songs', to='music.Album')),
                ('liked_by', models.ManyToManyField(related_name='like_songs', through='music.LikeShip', to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='songs', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-created', 'user'),
            },
        ),
        migrations.AddField(
            model_name='likeship',
            name='song',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='music.Song'),
        ),
        migrations.AddField(
            model_name='likeship',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterUniqueTogether(
            name='likeship',
            unique_together=set([('user', 'song')]),
        ),
    ]
