# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-26 05:15
from __future__ import unicode_literals

from decimal import Decimal
from django.conf import settings
import django.core.validators
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='Account',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('balance', models.PositiveIntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='BuyTransaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('quantity', models.PositiveIntegerField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=9, validators=django.core.validators.MinValueValidator(Decimal('0.01')))),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='History',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='SellTransaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('quantity', models.PositiveIntegerField()),
                ('price', models.DecimalField(decimal_places=2, max_digits=9, validators=django.core.validators.MinValueValidator(Decimal('0.01')))),
                ('history', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.History')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Stock',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ticker', models.CharField(max_length=4, unique=True)),
            ],
        ),
        migrations.AddField(
            model_name='selltransaction',
            name='stock',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.Stock'),
        ),
        migrations.AddField(
            model_name='buytransaction',
            name='history',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.History'),
        ),
        migrations.AddField(
            model_name='buytransaction',
            name='stock',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.Stock'),
        ),
        migrations.AddField(
            model_name='account',
            name='history',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='finance.History'),
        ),
        migrations.AddField(
            model_name='account',
            name='user',
            field=models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
    ]
