# Generated by Django 2.2.9 on 2020-03-02 02:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=80)),
            ],
            options={
                'db_table': 'company',
            },
        ),
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('currency', models.CharField(max_length=3, primary_key=True, serialize=False)),
            ],
            options={
                'db_table': 'currency',
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=80, unique=True)),
            ],
            options={
                'db_table': 'product',
            },
        ),
        migrations.CreateModel(
            name='Trade',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('date', models.DateTimeField()),
                ('notional_amount', models.FloatField()),
                ('quantity', models.IntegerField()),
                ('maturity_date', models.DateField()),
                ('underlying_price', models.FloatField()),
                ('strike_price', models.FloatField()),
                ('buying_party', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='buyer', to='api.Company')),
                ('notional_currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notional', to='api.Currency')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='trade_product', to='api.Product')),
                ('selling_party', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seller', to='api.Company')),
                ('underlying_currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='underlying', to='api.Currency')),
            ],
            options={
                'db_table': 'trade',
            },
        ),
        migrations.CreateModel(
            name='EditedTrade',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('edit_date', models.DateTimeField()),
                ('attribute_edited', models.CharField(choices=[('PR', 'product'), ('BP', 'buying_party'), ('SP', 'selling_party'), ('NC', 'notional_currency'), ('QT', 'quantity'), ('MD', 'maturity_date'), ('UP', 'underlying_price'), ('UC', 'underlying_currency'), ('ST', 'strike_price')], max_length=2)),
                ('old_value', models.CharField(max_length=32)),
                ('new_value', models.CharField(max_length=32)),
                ('trade_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='edited_trade', to='api.Trade')),
            ],
            options={
                'db_table': 'edited_trade',
            },
        ),
        migrations.CreateModel(
            name='DeletedTrade',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('deleted_at', models.DateTimeField(auto_now=True)),
                ('trade_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='deleted_trade', to='api.Trade')),
            ],
            options={
                'db_table': 'deleted_trade',
            },
        ),
        migrations.CreateModel(
            name='StockPrice',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('date', models.DateField()),
                ('value', models.FloatField()),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Company')),
            ],
            options={
                'db_table': 'stock_price',
                'unique_together': {('company', 'date')},
            },
        ),
        migrations.CreateModel(
            name='ProductSeller',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='company', to='api.Company')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_selling', to='api.Product')),
            ],
            options={
                'db_table': 'product_seller',
                'unique_together': {('product', 'company')},
            },
        ),
        migrations.CreateModel(
            name='ProductPrice',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('date', models.DateField()),
                ('value', models.FloatField()),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product', to='api.Product')),
            ],
            options={
                'db_table': 'product_price',
                'unique_together': {('date', 'product')},
            },
        ),
        migrations.CreateModel(
            name='CurrencyPrice',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('date', models.DateField()),
                ('value', models.FloatField()),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Currency')),
            ],
            options={
                'db_table': 'currency_price',
                'unique_together': {('currency', 'date')},
            },
        ),
    ]
