# Generated by Django 3.2.7 on 2021-10-18 23:21

from django.conf import settings
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='Client',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=120)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('total', models.DecimalField(decimal_places=2, default=0.0, max_digits=20)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('client', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='app.client')),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=120)),
                ('price', models.DecimalField(decimal_places=2, default=0.0, max_digits=20)),
                ('inventory', models.IntegerField(default=0)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='OrderProduct',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.IntegerField(default=1)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.order')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.product')),
            ],
            options={
                'unique_together': {('order', 'product')},
            },
        ),
        migrations.AddField(
            model_name='order',
            name='products',
            field=models.ManyToManyField(through='app.OrderProduct', to='app.Product'),
        ),
        migrations.AddField(
            model_name='order',
            name='user',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
        ),
    ]

[((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((2437, 2505), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'through': '"""app.OrderProduct"""', 'to': '"""app.Product"""'}), "(through='app.OrderProduct', to='app.Product')\n", (2459, 2505), False, 'from django.db import migrations, models\n'), ((2622, 2742), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': 'settings.AUTH_USER_MODEL'}), '(blank=True, null=True, on_delete=django.db.models.\n    deletion.SET_NULL, to=settings.AUTH_USER_MODEL)\n', (2639, 2742), False, 'from django.db import migrations, models\n'), ((435, 531), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n    verbose_name='ID')\n", (454, 531), False, 'from django.db import migrations, models\n'), ((555, 587), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (571, 587), False, 'from django.db import migrations, models\n'), ((718, 814), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n    verbose_name='ID')\n", (737, 814), False, 'from django.db import migrations, models\n'), ((839, 904), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(2)', 'default': '(0.0)', 'max_digits': '(20)'}), '(decimal_places=2, default=0.0, max_digits=20)\n', (858, 904), False, 'from django.db import migrations, models\n'), ((937, 976), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (957, 976), False, 'from django.db import migrations, models\n'), ((1006, 1114), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""app.client"""'}), "(blank=True, null=True, on_delete=django.db.models.\n    deletion.SET_NULL, to='app.client')\n", (1023, 1114), False, 'from django.db import migrations, models\n'), ((1242, 1338), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n    verbose_name='ID')\n", (1261, 1338), False, 'from django.db import migrations, models\n'), ((1362, 1394), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (1378, 1394), False, 'from django.db import migrations, models\n'), ((1423, 1488), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(2)', 'default': '(0.0)', 'max_digits': '(20)'}), '(decimal_places=2, default=0.0, max_digits=20)\n', (1442, 1488), False, 'from django.db import migrations, models\n'), ((1521, 1551), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (1540, 1551), False, 'from django.db import migrations, models\n'), ((1579, 1699), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': 'settings.AUTH_USER_MODEL'}), '(blank=True, null=True, on_delete=django.db.models.\n    deletion.SET_NULL, to=settings.AUTH_USER_MODEL)\n', (1596, 1699), False, 'from django.db import migrations, models\n'), ((1832, 1928), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n    verbose_name='ID')\n", (1851, 1928), False, 'from django.db import migrations, models\n'), ((1956, 1986), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(1)'}), '(default=1)\n', (1975, 1986), False, 'from django.db import migrations, models\n'), ((2015, 2093), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""app.order"""'}), "(on_delete=django.db.models.deletion.CASCADE, to='app.order')\n", (2032, 2093), False, 'from django.db import migrations, models\n'), ((2124, 2209), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""app.product"""'}), "(on_delete=django.db.models.deletion.CASCADE, to='app.product'\n    )\n", (2141, 2209), False, 'from django.db import migrations, models\n')]