# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-29 16:43
from __future__ import unicode_literals

import app1.models
from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Card',
            fields=[
                ('idCard', models.AutoField(primary_key=True, serialize=False)),
                ('cardLevel', models.SmallIntegerField(default=1)),
                ('cardCount', models.SmallIntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='CardType',
            fields=[
                ('idCardType', models.AutoField(primary_key=True, serialize=False)),
                ('Cardid', models.IntegerField(db_index=True, null=True, unique=True)),
                ('name', models.CharField(max_length=40)),
            ],
        ),
        migrations.CreateModel(
            name='Clan',
            fields=[
                ('idClan', models.AutoField(primary_key=True, serialize=False)),
                ('clanName', models.CharField(max_length=30)),
                ('clanDescription', models.TextField(blank=True, max_length=140, null=True)),
                ('clanTag', models.CharField(blank=True, db_index=True, max_length=10, null=True, unique=True)),
                ('clanLocation', models.CharField(blank=True, max_length=30, null=True)),
                ('clanType', models.IntegerField(default=0)),
                ('clanMinimumTrophies', models.IntegerField(default=0)),
                ('clanScore', models.IntegerField(default=0)),
                ('totalDonation', models.IntegerField(default=0)),
                ('clanBadge', models.IntegerField(blank=True, default=0, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('idUser', models.AutoField(primary_key=True, serialize=False)),
                ('deviceID', models.CharField(blank=True, max_length=200, null=True)),
                ('username', models.CharField(blank=True, default='', max_length=40)),
                ('trophiesCount', models.IntegerField(default=0)),
                ('winCount', models.IntegerField(default=0)),
                ('loseCount', models.IntegerField(default=0)),
                ('deck1', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, default=app1.models.default_deck_gen, null=True, size=8)),
                ('xp', models.IntegerField(default=0)),
                ('level', models.IntegerField(default=0)),
                ('totalDonations', models.IntegerField(default=0)),
                ('gem', models.IntegerField(default=0)),
                ('gold', models.IntegerField(default=0)),
                ('basicUser', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='UserClanData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('position', models.IntegerField(choices=[(0, 'Member'), (1, 'Leader')], default=0)),
                ('donate_count', models.IntegerField(default=0)),
                ('lastRequestTime', models.IntegerField(default=0)),
            ],
        ),
        migrations.AddField(
            model_name='user',
            name='clanData',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='app1.UserClanData'),
        ),
        migrations.AddField(
            model_name='user',
            name='userCards',
            field=models.ManyToManyField(through='app1.Card', to='app1.CardType'),
        ),
        migrations.AddField(
            model_name='user',
            name='userClan',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='users', to='app1.Clan'),
        ),
        migrations.AddField(
            model_name='card',
            name='cardType',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cards', to='app1.CardType'),
        ),
        migrations.AddField(
            model_name='card',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cards', to='app1.User'),
        ),
        migrations.AlterUniqueTogether(
            name='card',
            unique_together=set([('user', 'cardType')]),
        ),
        migrations.AlterIndexTogether(
            name='card',
            index_together=set([('user', 'cardType')]),
        ),
    ]
