<filename>stores/migrations/0001_initial.py
# Generated by Django 3.1.7 on 2021-03-07 17:35

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=20)),
                ('middle_name', models.CharField(max_length=20)),
                ('last_name', models.CharField(max_length=20)),
                ('address', models.CharField(max_length=50)),
                ('zip_code', models.CharField(max_length=12)),
                ('email', models.EmailField(max_length=254)),
                ('phone', models.CharField(max_length=15)),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cities', to='stores.city')),
            ],
        ),
        migrations.CreateModel(
            name='District',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField(help_text='Add order date')),
                ('customer', models.ForeignKey(help_text='Select customer', on_delete=django.db.models.deletion.CASCADE, related_name='customers', to='stores.customer')),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=80)),
                ('reference', models.CharField(max_length=10)),
                ('brand', models.CharField(max_length=20)),
                ('price', models.DecimalField(decimal_places=2, max_digits=6, validators=[django.core.validators.MinValueValidator(0)])),
                ('description', models.CharField(max_length=300)),
            ],
        ),
        migrations.CreateModel(
            name='Seller',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=20)),
                ('middle_name', models.CharField(max_length=20)),
                ('last_name', models.CharField(max_length=20)),
                ('seller_id', models.CharField(max_length=5)),
            ],
        ),
        migrations.CreateModel(
            name='PointOfSale',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('address', models.CharField(max_length=50)),
                ('zip_code', models.CharField(max_length=12)),
                ('phone', models.CharField(max_length=12)),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='stores.city')),
                ('district', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='stores.district')),
            ],
        ),
        migrations.CreateModel(
            name='OrderDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField()),
                ('payment', models.CharField(choices=[('undefined', 'Undefined'), ('cash', 'Cash'), ('checks', 'Checks'), ('debit_cards', 'Debit cards'), ('credit_cards', 'Credit cards'), ('mobile_payments', 'Mobile payments'), ('bank_transfers', 'Bank transfers')], default='undefined', max_length=20, verbose_name='Payments Method')),
                ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='stores.pointofsale')),
                ('order', models.ForeignKey(help_text='Select order by customer', on_delete=django.db.models.deletion.CASCADE, related_name='products', to='stores.order')),
                ('product', models.ForeignKey(help_text='Select purchased product', on_delete=django.db.models.deletion.CASCADE, related_name='orders', to='stores.product')),
                ('seller', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sellers', to='stores.seller')),
            ],
        ),
        migrations.AddField(
            model_name='customer',
            name='district',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='districts', to='stores.district'),
        ),
    ]
