# Generated by Django 3.0.4 on 2020-04-28 13:41

from django.conf import settings
import django.contrib.postgres.fields.jsonb
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='DatasetQueues',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uploaded_date', models.DateTimeField(auto_now_add=True)),
                ('source_file_path', models.TextField()),
                ('source_file_type', models.CharField(choices=[('csv', 'CSV'), ('xls', 'Excel'), ('xlsx', 'Excel'), ('kml', 'KML'), ('kmz', 'KMZ'), ('shp', 'Shapefile'), ('zip', 'Zipfile'), ('tiff', 'GeoTIFF'), ('json', 'GeoJSON'), ('geojson', 'GeoJSON')], max_length=30)),
                ('progress', models.IntegerField(default=0)),
                ('has_errors', models.BooleanField(default=False)),
                ('status', models.CharField(default='A', max_length=10)),
                ('uploaded_by', models.ForeignKey(blank=True, db_column='uploaded_by', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'dataset_queues',
            },
        ),
        migrations.CreateModel(
            name='Datasets',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dataset_queue_id', models.ForeignKey(blank=True, db_column='dataset_queue_id', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dataset', to='datasets.DatasetQueues')),
            ],
            options={
                'db_table': 'datasets',
            },
        ),
        migrations.CreateModel(
            name='DatasetQueueErrors',
            fields=[
                ('row_no', models.IntegerField(primary_key=True, serialize=False)),
                ('error', models.TextField()),
                ('dataset_queue_id', models.ForeignKey(db_column='dataset_queue_id', on_delete=django.db.models.deletion.CASCADE, to='datasets.DatasetQueues')),
            ],
            options={
                'db_table': 'dataset_queue_errors',
            },
        ),
        migrations.CreateModel(
            name='DatasetData',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('row_no', models.IntegerField()),
                ('data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('dataset_id', models.ForeignKey(db_column='dataset_id', on_delete=django.db.models.deletion.CASCADE, to='datasets.Datasets')),
            ],
            options={
                'db_table': 'dataset_data',
                'unique_together': {('dataset_id', 'row_no')},
            },
        ),
    ]
