# Generated by Django 2.2.5 on 2019-09-20 21:58

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='None', help_text='Unique code, only specified characters are allowed', max_length=50, unique=True)),
                ('name', models.CharField(default='None', help_text='Name, most characters are allowed', max_length=50)),
                ('description', models.TextField(default='None', help_text='Use short sentence to discribe your object', max_length=512)),
                ('created_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('length', models.DecimalField(decimal_places=9, default=0, help_text='Length of the object', max_digits=30)),
                ('width', models.DecimalField(decimal_places=9, default=0, help_text='Width of the object', max_digits=30)),
                ('height', models.DecimalField(decimal_places=9, default=0, help_text='Height of the object', max_digits=30)),
                ('unit', models.SmallIntegerField(choices=[(1, 'pcs'), (10, 'm'), (11, 'cm'), (12, 'mm'), (20, 'g'), (21, 'mg'), (22, 'kg'), (30, 'l'), (40, 'cubic meter')], default=1, help_text='Unit of consumption')),
                ('material_type', models.CharField(choices=[('NORMAL', 'Normal'), ('PRODUCT', 'Product'), ('FIXTURE', 'Fixture')], default='NORMAL', help_text='Type of the material, product and normal is different', max_length=20)),
                ('price', models.DecimalField(decimal_places=9, default=0, help_text='Price per unit', max_digits=50)),
                ('currency', models.CharField(default='TBD', help_text='Currency code of the price', max_length=3)),
                ('revision', models.CharField(default='0', help_text='Revision number', max_length=20)),
                ('status', models.SmallIntegerField(choices=[('100', 'CREATE'), ('200', 'RELEASE'), ('300', 'DRAFT')], default=100, help_text='Status')),
            ],
            options={
                'verbose_name_plural': 'Material master',
                'db_table': 'material',
            },
        ),
        migrations.CreateModel(
            name='MaterialCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(default='None', help_text='Unique code, only specified characters are allowed', max_length=50, unique=True)),
                ('name', models.CharField(default='None', help_text='Name, most characters are allowed', max_length=50)),
                ('description', models.TextField(default='None', help_text='Use short sentence to discribe your object', max_length=512)),
                ('created_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('updated_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name_plural': 'Material category',
                'db_table': 'material_category',
            },
        ),
        migrations.CreateModel(
            name='MaterialCategoryAttr',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('attr_name', models.CharField(choices=[('PLANT_CODE', 'Plant code(2 digits)'), ('NATION', 'Nation'), ('MANAGER', 'Managers Name'), ('PHONE_NUMBER', 'Contact Phone Number')], max_length=100)),
                ('attr_value', models.CharField(max_length=100)),
                ('material_category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='product.MaterialCategory')),
            ],
            options={
                'verbose_name_plural': 'Extended attributes',
                'db_table': 'material_category_attr',
            },
        ),
        migrations.CreateModel(
            name='MaterialAttr',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_by', models.CharField(default='auth.User', editable=False, max_length=50)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('attr_name', models.CharField(choices=[('PLANT_CODE', 'Plant code(2 digits)'), ('NATION', 'Nation'), ('MANAGER', 'Managers Name'), ('PHONE_NUMBER', 'Contact Phone Number')], max_length=100)),
                ('attr_value', models.CharField(max_length=100)),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='product.Material')),
            ],
            options={
                'verbose_name_plural': 'Extended attributes',
                'db_table': 'material_attr',
            },
        ),
        migrations.AddConstraint(
            model_name='materialcategoryattr',
            constraint=models.UniqueConstraint(fields=('material_category', 'attr_name'), name='uniq_material_category_attr'),
        ),
        migrations.AddConstraint(
            model_name='materialattr',
            constraint=models.UniqueConstraint(fields=('material', 'attr_name'), name='uniq_material_attr'),
        ),
    ]
