# Generated by Django 3.1.1 on 2020-11-30 09:34

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Measurement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
            ],
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('symbol_name', models.CharField(max_length=10)),
                ('description', models.CharField(blank=True, max_length=2000, null=True)),
                ('measurement_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='unitconverterapp.measurement')),
            ],
        ),
        migrations.CreateModel(
            name='UnitArticle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('unit_description', models.TextField()),
                ('unit_title', models.CharField(max_length=100)),
                ('unit_article_link', models.URLField(null=True)),
                ('unit_img', models.ImageField(blank=True, null=True, upload_to='unit')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='unit_name', to='unitconverterapp.unit')),
            ],
        ),
        migrations.CreateModel(
            name='MeasurementArticle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('measurement_description', models.TextField()),
                ('measurement_title', models.CharField(max_length=100)),
                ('measurement_article_link', models.URLField(null=True)),
                ('measurement_img', models.ImageField(blank=True, null=True, upload_to='measurement')),
                ('measurement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='measurement_name', to='unitconverterapp.measurement')),
            ],
        ),
        migrations.CreateModel(
            name='Conversion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('converter_name', models.CharField(max_length=50)),
                ('rate', models.FloatField()),
                ('name', models.SlugField(max_length=32)),
                ('from_unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='from_conversions', to='unitconverterapp.unit')),
                ('to_unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='to_conversions', to='unitconverterapp.unit')),
            ],
        ),
        migrations.AddConstraint(
            model_name='conversion',
            constraint=models.UniqueConstraint(fields=('from_unit', 'to_unit'), name='uniq_from_to_units'),
        ),
        migrations.AddConstraint(
            model_name='conversion',
            constraint=models.UniqueConstraint(fields=('name',), name='uniq_converter_name'),
        ),
    ]
