# Generated by Django 2.0.2 on 2018-04-29 17:23

import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Document',
            fields=[
                ('doc_id', models.CharField(default=uuid.uuid4, editable=False, max_length=48, primary_key=True, serialize=False)),
                ('description', models.CharField(blank=True, max_length=255)),
                ('document', models.FileField(upload_to='documents/')),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'document',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Line',
            fields=[
                ('lin_id', models.CharField(max_length=255, primary_key=True, serialize=False)),
                ('lin_name', models.CharField(blank=True, max_length=255, null=True, unique=True)),
            ],
            options={
                'db_table': 'line',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Member',
            fields=[
                ('mem_id', models.CharField(max_length=255, primary_key=True, serialize=False)),
                ('mem_version', models.CharField(blank=True, max_length=255, null=True)),
                ('doc_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Document')),
            ],
            options={
                'db_table': 'member',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OperationalPoint',
            fields=[
                ('opp_id', models.CharField(max_length=255, primary_key=True, serialize=False)),
                ('opp_name', models.CharField(blank=True, max_length=255, null=True)),
                ('opp_uniqueid', models.CharField(blank=True, max_length=255, null=True, unique=True)),
                ('opp_lon', models.FloatField(blank=True, null=True)),
                ('opp_lat', models.FloatField(blank=True, null=True)),
                ('geom', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)),
                ('opp_taftapcode', models.CharField(blank=True, max_length=255, null=True)),
                ('opp_date_start', models.DateField(blank=True, null=True)),
                ('opp_date_end', models.DateField(blank=True, null=True)),
                ('opp_track_nb', models.IntegerField(blank=True, null=True)),
                ('opp_tunnel_nb', models.IntegerField(blank=True, null=True)),
                ('opp_platform_nb', models.IntegerField(blank=True, null=True)),
                ('mem_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Member')),
            ],
            options={
                'db_table': 'operational_point',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OppParameterValue',
            fields=[
                ('opv_id', models.AutoField(primary_key=True, serialize=False)),
                ('opv_value', models.CharField(blank=True, max_length=255, null=True)),
                ('opp_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.OperationalPoint')),
            ],
            options={
                'db_table': 'opp_parameter_value',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OpType',
            fields=[
                ('oty_id', models.IntegerField(primary_key=True, serialize=False)),
                ('oty_name', models.CharField(blank=True, max_length=255, null=True)),
            ],
            options={
                'db_table': 'op_type',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Parameter',
            fields=[
                ('par_id', models.CharField(max_length=255, primary_key=True, serialize=False)),
                ('par_name', models.CharField(blank=True, max_length=255, null=True, unique=True)),
                ('par_type', models.CharField(choices=[(1, 'TRACK'), (2, 'SOL_TRACK'), (3, 'TUNNEL'), (4, 'PLATFORM')], max_length=254)),
            ],
            options={
                'db_table': 'parameter',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ParameterDefinition',
            fields=[
                ('ppv_id', models.AutoField(primary_key=True, serialize=False)),
                ('par_name', models.CharField(blank=True, max_length=255, null=True, unique=True)),
                ('ppv_value', models.CharField(blank=True, max_length=255, null=True)),
                ('ppv_optional_value', models.CharField(blank=True, max_length=255, null=True)),
                ('par', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Parameter')),
            ],
            options={
                'db_table': 'parameter_definition',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='SectionOfLine',
            fields=[
                ('sol_id', models.CharField(max_length=255, primary_key=True, serialize=False)),
                ('sol_length', models.FloatField(blank=True, null=True)),
                ('sol_nature', models.CharField(blank=True, max_length=255, null=True)),
                ('sol_imcode', models.CharField(blank=True, max_length=255, null=True)),
                ('sol_date_start', models.DateField(blank=True, null=True)),
                ('sol_date_end', models.DateField(blank=True, null=True)),
                ('sol_track_nb', models.IntegerField(blank=True, null=True)),
                ('sol_tunnel_nb', models.IntegerField(blank=True, null=True)),
                ('lin', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Line')),
                ('mem', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Member')),
                ('opp_end', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opp_end', to='geo_app.OperationalPoint')),
                ('opp_start', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opp_start', to='geo_app.OperationalPoint')),
            ],
            options={
                'db_table': 'section_of_line',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='SolParameterValue',
            fields=[
                ('spv_id', models.AutoField(primary_key=True, serialize=False)),
                ('spv_value', models.CharField(blank=True, max_length=255, null=True)),
                ('par_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='geo_app.Parameter')),
                ('sol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='geo_app.SectionOfLine')),
            ],
            options={
                'db_table': 'sol_parameter_value',
                'managed': True,
            },
        ),
        migrations.AddField(
            model_name='oppparametervalue',
            name='par_name',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Parameter'),
        ),
        migrations.AddField(
            model_name='operationalpoint',
            name='oty_id',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.OpType'),
        ),
        migrations.AddField(
            model_name='line',
            name='mem',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='geo_app.Member'),
        ),
        migrations.AlterUniqueTogether(
            name='solparametervalue',
            unique_together={('sol', 'par_name', 'spv_value')},
        ),
        migrations.AlterUniqueTogether(
            name='sectionofline',
            unique_together={('opp_start', 'opp_end')},
        ),
        migrations.AlterUniqueTogether(
            name='oppparametervalue',
            unique_together={('opp_id', 'par_name', 'opv_value')},
        ),
    ]
