# Generated by Django 3.0.8 on 2020-08-12 20:35

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('product', '0001_initial'),
        ('order', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('order_uid', models.CharField(max_length=30, unique=True)),
                ('shipping_price', models.PositiveIntegerField(verbose_name='배송비')),
                ('shipping_address', models.CharField(max_length=200)),
                ('shipping_request_note', models.CharField(blank=True, max_length=200, null=True)),
                ('is_paid', models.BooleanField(default=False)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='orders', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '주문 내역',
                'verbose_name_plural': '주문 내역',
                'db_table': 'order',
            },
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('pay_price', models.PositiveIntegerField()),
                ('pay_method', models.PositiveSmallIntegerField(choices=[(0, 'CARD'), (1, 'KAKAO')])),
                ('additional_information', models.CharField(blank=True, max_length=250, null=True)),
                ('order', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payment', to='order.Order')),
            ],
            options={
                'verbose_name': '결제 정보',
                'verbose_name_plural': '결제 정보',
                'db_table': 'payment',
            },
        ),
        migrations.CreateModel(
            name='OrderProduct',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('product_price', models.PositiveIntegerField(verbose_name='주문 당시 상품 단가')),
                ('ordered_quantity', models.PositiveIntegerField(verbose_name='상품 주문 수량')),
                ('ordered_price', models.PositiveIntegerField(verbose_name='상품 주문 총액')),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'PENDING'), (1, 'NOT_PAID'), (2, 'PAID'), (3, 'REFUND'), (4, 'PARTIAL_REFUND')], default=0)),
                ('cart', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_products', to='order.Cart')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='order_products', to='order.Order')),
                ('product_option', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='order_products', to='product.ProductOption')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='order_products', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '상품별 주문 내역',
                'verbose_name_plural': '상품별 주문 내역',
                'db_table': 'order_product',
            },
        ),
    ]
