# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-06 15:28
from __future__ import unicode_literals

import annoying.fields
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='Category',
            fields=[
                ('catID', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('userid', models.AutoField(primary_key=True, serialize=False)),
                ('nickName', models.CharField(max_length=32)),
                ('avatarUrl', models.URLField(blank=True)),
                ('gender', models.CharField(choices=[('1', 'Male'), ('2', 'Female'), ('0', 'Unknown')], max_length=1)),
                ('city', models.CharField(blank=True, max_length=15)),
                ('province', models.CharField(blank=True, max_length=15)),
                ('country', models.CharField(blank=True, max_length=15)),
                ('language', models.CharField(blank=True, max_length=15)),
                ('created', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ('created',),
            },
        ),
        migrations.CreateModel(
            name='ESL',
            fields=[
                ('etagID', models.AutoField(primary_key=True, serialize=False)),
                ('modulePin', models.CharField(max_length=20, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('orderID', models.AutoField(primary_key=True, serialize=False)),
                ('quantity', models.IntegerField(default=1)),
                ('payMethod', models.CharField(max_length=20)),
                ('timeStamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('productID', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=30)),
                ('unitPrice', models.DecimalField(decimal_places=2, max_digits=5)),
                ('unitInStock', models.IntegerField()),
                ('unitOnOrder', models.IntegerField()),
                ('QuantityPerUnit', models.IntegerField()),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Category')),
            ],
        ),
        migrations.CreateModel(
            name='Rack',
            fields=[
                ('rackID', models.AutoField(primary_key=True, serialize=False)),
                ('length', models.IntegerField(default=900)),
                ('width', models.IntegerField(default=320)),
                ('height', models.IntegerField(default=1600)),
                ('level', models.IntegerField(default=4)),
                ('product_capacity', models.IntegerField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='RFID',
            fields=[
                ('rtagID', models.AutoField(primary_key=True, serialize=False)),
                ('PIN', models.CharField(max_length=30, unique=True)),
                ('status', models.CharField(max_length=1)),
                ('productID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Product')),
            ],
        ),
        migrations.CreateModel(
            name='Shop',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=20)),
                ('location', models.CharField(max_length=200)),
                ('size', models.DecimalField(decimal_places=2, max_digits=6)),
                ('rack_capacity', models.IntegerField(blank=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('opening', models.DateTimeField(blank=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shops', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('created',),
            },
        ),
        migrations.CreateModel(
            name='Supplier',
            fields=[
                ('supplierID', models.AutoField(primary_key=True, serialize=False)),
                ('companyName', models.CharField(max_length=30)),
                ('contactName', models.CharField(max_length=20)),
                ('contactPhone', models.DecimalField(decimal_places=0, max_digits=20)),
                ('address', models.CharField(blank=True, max_length=100)),
                ('city', models.CharField(blank=True, max_length=20)),
                ('province', models.CharField(blank=True, max_length=20)),
                ('country', models.CharField(blank=True, max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='Face',
            fields=[
                ('userid', annoying.fields.AutoOneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='api.Customer')),
                ('image', models.ImageField(upload_to='face_images')),
            ],
        ),
        migrations.CreateModel(
            name='WxUser',
            fields=[
                ('userid', annoying.fields.AutoOneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='api.Customer')),
                ('code', models.CharField(max_length=32)),
                ('openid', models.CharField(max_length=32)),
                ('session_key', models.CharField(max_length=32)),
                ('unionid', models.CharField(blank=True, max_length=32)),
                ('third_session', models.CharField(max_length=128)),
                ('created', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ('created',),
            },
        ),
        migrations.AddField(
            model_name='product',
            name='supplier',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Supplier'),
        ),
        migrations.AddField(
            model_name='order',
            name='productID',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='api.Product'),
        ),
        migrations.AddField(
            model_name='order',
            name='shopID',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='api.Shop'),
        ),
        migrations.AddField(
            model_name='order',
            name='userID',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='api.Customer'),
        ),
        migrations.AddField(
            model_name='esl',
            name='productID',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Product'),
        ),
        migrations.AddField(
            model_name='esl',
            name='rackID',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Rack'),
        ),
        migrations.AddField(
            model_name='customer',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='customers', to=settings.AUTH_USER_MODEL),
        ),
    ]
