# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-20 09:38
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import smart_selects.db_fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ChildDevice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('serial_number', models.CharField(max_length=255, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
            options={
                'verbose_name_plural': 'Countries',
            },
        ),
        migrations.CreateModel(
            name='Data',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('storage_location', models.CharField(max_length=255)),
                ('checked', models.BooleanField()),
            ],
        ),
        migrations.CreateModel(
            name='DeviceType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.CharField(blank=True, help_text='If adding a new device leave this field blank.', max_length=255, null=True)),
                ('code', models.CharField(blank=True, help_text='If adding a new device leave this field blank.', max_length=255, null=True, unique=True)),
                ('name', models.CharField(help_text='Use a descriptive but short name for the device.', max_length=255)),
                ('definition', models.TextField(help_text="Give a full description of the device, including it's make, model, how it is used and a URL describing the device where possible.")),
                ('version', models.CharField(blank=True, help_text='If adding a new device leave this field blank.', max_length=255, null=True)),
                ('deprecated', models.CharField(blank=True, help_text='If adding a new device leave this field blank.', max_length=255, null=True)),
                ('date', models.DateTimeField(blank=True, help_text='If adding a new device leave this field blank.', null=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], default='generatedforace', help_text='Use the default or speak to the data management team if generated for ACE does not apply.', max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('number', models.AutoField(primary_key=True, serialize=False)),
                ('child_devices', smart_selects.db_fields.ChainedManyToManyField(chained_field='parent_device', chained_model_field='possible_parents', to='main.ChildDevice')),
            ],
            options={
                'permissions': (('cannot_change_events_special', 'Cannot change events (special)'),),
            },
        ),
        migrations.CreateModel(
            name='EventAction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(choices=[('TBEGNS', 'Begins'), ('TENDS', 'Ends'), ('TINSTANT', 'Instant')], max_length=255)),
                ('time', models.DateTimeField()),
                ('latitude', models.FloatField()),
                ('longitude', models.FloatField()),
                ('water_depth', models.FloatField(blank=True, null=True)),
                ('general_comments', models.TextField(blank=True, null=True)),
                ('data_source_comments', models.TextField(blank=True, null=True)),
            ],
            options={
                'permissions': (('cannot_change_events_action_special', 'Cannot change events action (special)'),),
            },
        ),
        migrations.CreateModel(
            name='EventActionDescription',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('source', models.CharField(blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='FilesStorage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('relative_path', models.CharField(max_length=255)),
                ('kilobytes', models.BigIntegerField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='FilesStorageGeneral',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('used', models.BigIntegerField()),
                ('free', models.BigIntegerField()),
                ('time', models.DateTimeField(default=django.utils.timezone.now)),
            ],
        ),
        migrations.CreateModel(
            name='Leg',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.IntegerField(unique=True)),
                ('start_time', models.DateTimeField()),
                ('end_time', models.DateTimeField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_time', models.DateTimeField()),
                ('subject', models.CharField(max_length=255)),
                ('message', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='NetworkHost',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip', models.GenericIPAddressField()),
                ('hostname', models.CharField(max_length=255)),
                ('location', models.CharField(blank=True, help_text='In which floor, laboratory, container is this device', max_length=255, null=True)),
                ('comment', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Organisation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('address', models.CharField(blank=True, max_length=255, null=True)),
                ('country', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='main.Country')),
            ],
        ),
        migrations.CreateModel(
            name='ParentDevice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('definition', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name_title', models.CharField(blank=True, choices=[('Mr', 'Mr.'), ('Ms', 'Ms.'), ('Miss', 'Miss'), ('Mrs', 'Mrs.'), ('Dr', 'Dr.'), ('Prof', 'Prof.')], max_length=255, null=True)),
                ('name_first', models.CharField(max_length=255)),
                ('name_middle', models.CharField(blank=True, max_length=255, null=True)),
                ('name_last', models.CharField(max_length=255)),
                ('initials', models.CharField(max_length=5, unique=True)),
                ('organisation', models.ManyToManyField(to='main.Organisation')),
            ],
            options={
                'verbose_name_plural': 'People',
            },
        ),
        migrations.CreateModel(
            name='Platform',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.CharField(blank=True, max_length=255, null=True)),
                ('code', models.CharField(blank=True, max_length=255, null=True)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], max_length=255)),
                ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Country')),
            ],
        ),
        migrations.CreateModel(
            name='PlatformType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.CharField(blank=True, max_length=255, null=True)),
                ('code', models.CharField(blank=True, max_length=255, null=True)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('definition', models.CharField(max_length=255)),
                ('version', models.CharField(blank=True, max_length=255, null=True)),
                ('deprecated', models.CharField(blank=True, max_length=255, null=True)),
                ('date', models.DateTimeField(blank=True, max_length=255, null=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Port',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('url', models.CharField(blank=True, max_length=255, null=True)),
                ('code', models.CharField(max_length=255, unique=True)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('latitude', models.FloatField()),
                ('longitude', models.FloatField()),
                ('version', models.CharField(blank=True, max_length=255, null=True)),
                ('deprecated', models.CharField(blank=True, max_length=255, null=True)),
                ('date', models.CharField(blank=True, max_length=255, null=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], max_length=255)),
                ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Country')),
            ],
        ),
        migrations.CreateModel(
            name='PositionUncertainty',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=255, unique=True)),
                ('table_code', models.CharField(max_length=255)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], default='britishoceanoraphicdatacentre', max_length=255)),
            ],
            options={
                'verbose_name_plural': 'Position uncertainties',
            },
        ),
        migrations.CreateModel(
            name='Preservation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.IntegerField(unique=True)),
                ('title', models.CharField(max_length=255, unique=True)),
                ('alternative_title', models.CharField(blank=True, max_length=255, null=True)),
                ('abstract', models.TextField(blank=True, null=True)),
                ('principal_investigator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='Principal_investigator', to='main.Person')),
            ],
        ),
        migrations.CreateModel(
            name='Sample',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=255, unique=True)),
                ('destination', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='SampleContent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Ship',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('imo', models.CharField(blank=True, max_length=255, null=True)),
                ('callsign', models.CharField(blank=True, max_length=255, null=True)),
                ('length', models.CharField(blank=True, max_length=255, null=True)),
                ('breadth', models.CharField(blank=True, max_length=255, null=True)),
                ('power', models.CharField(blank=True, max_length=255, null=True)),
                ('gross_weight', models.CharField(blank=True, max_length=255, null=True)),
                ('noise_design', models.CharField(blank=True, max_length=255, null=True)),
                ('noise', models.CharField(blank=True, max_length=255, null=True)),
                ('notes', models.TextField(blank=True, null=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], max_length=255)),
                ('name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Platform')),
            ],
        ),
        migrations.CreateModel(
            name='SpeciesClassification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phylum', models.CharField(max_length=255)),
                ('class2', models.CharField(db_column='class', max_length=255, verbose_name='Class')),
                ('order', models.CharField(max_length=255)),
                ('family', models.CharField(max_length=255)),
                ('genus', models.CharField(max_length=255)),
                ('species', models.CharField(max_length=255)),
            ],
            options={
                'verbose_name_plural': 'Species classification',
            },
        ),
        migrations.CreateModel(
            name='Station',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('latitude', models.FloatField()),
                ('longitude', models.FloatField()),
                ('arrival_time', models.DateTimeField(blank=True, null=True)),
                ('departure_time', models.DateTimeField(blank=True, null=True)),
                ('water_depth', models.FloatField(blank=True, null=True)),
                ('comment', models.TextField(blank=True, null=True)),
                ('leg', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Leg')),
                ('position_source', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='station_position_time_source', to='main.ChildDevice')),
                ('position_uncertainty', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.PositionUncertainty')),
                ('time_source', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='station_device_time_source', to='main.ChildDevice')),
            ],
        ),
        migrations.CreateModel(
            name='StationType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Storage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='StorageCrate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('location', models.CharField(max_length=255)),
                ('description', models.CharField(blank=True, max_length=255, null=True)),
                ('comment', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='TimeUncertainty',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('table_code', models.CharField(max_length=255)),
                ('code', models.CharField(max_length=255, unique=True)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('source', models.CharField(choices=[('seadatanet', 'Sea Data Net'), ('seavox', 'SeaVoX'), ('globalchangemasterdirectory', 'Global Change Master Directory'), ('generatedforace', 'Generated for ACE'), ('britishoceanographicdatacentre', 'British Oceanographic Data Centre (BODC)')], default='britishoceanoraphicdatacentre', max_length=255)),
            ],
            options={
                'verbose_name_plural': 'Time uncertainties',
            },
        ),
        migrations.AddField(
            model_name='station',
            name='time_uncertainty',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='main.TimeUncertainty'),
        ),
        migrations.AddField(
            model_name='station',
            name='type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.StationType'),
        ),
        migrations.AlterUniqueTogether(
            name='speciesclassification',
            unique_together=set([('phylum', 'class2', 'order', 'family', 'genus', 'species')]),
        ),
        migrations.AddField(
            model_name='samplecontent',
            name='species_classification',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.SpeciesClassification'),
        ),
        migrations.AddField(
            model_name='sample',
            name='contents',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.SampleContent'),
        ),
        migrations.AddField(
            model_name='sample',
            name='event',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Event'),
        ),
        migrations.AddField(
            model_name='sample',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Person'),
        ),
        migrations.AddField(
            model_name='sample',
            name='preservation',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Preservation'),
        ),
        migrations.AddField(
            model_name='sample',
            name='storage',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Storage'),
        ),
        migrations.AddField(
            model_name='platform',
            name='platformtype',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.PlatformType'),
        ),
        migrations.AddField(
            model_name='person',
            name='project',
            field=models.ManyToManyField(to='main.Project'),
        ),
        migrations.AddField(
            model_name='leg',
            name='end_port',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='end_port', to='main.Port'),
        ),
        migrations.AddField(
            model_name='leg',
            name='start_port',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='start_port', to='main.Port'),
        ),
        migrations.AddField(
            model_name='eventaction',
            name='description',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.EventActionDescription'),
        ),
        migrations.AddField(
            model_name='eventaction',
            name='event',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Event'),
        ),
        migrations.AddField(
            model_name='eventaction',
            name='position_source',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='eventaction_position_time_source', to='main.ChildDevice'),
        ),
        migrations.AddField(
            model_name='eventaction',
            name='position_uncertainty',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.PositionUncertainty'),
        ),
        migrations.AddField(
            model_name='eventaction',
            name='time_source',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='eventaction_device_time_source', to='main.ChildDevice'),
        ),
        migrations.AddField(
            model_name='eventaction',
            name='time_uncertainty',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.TimeUncertainty'),
        ),
        migrations.AddField(
            model_name='event',
            name='parent_device',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parent_device_event', to='main.ParentDevice'),
        ),
        migrations.AddField(
            model_name='event',
            name='station',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='main.Station'),
        ),
        migrations.AddField(
            model_name='data',
            name='event',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Event01', to='main.Event'),
        ),
        migrations.AddField(
            model_name='data',
            name='project',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Project'),
        ),
        migrations.AddField(
            model_name='childdevice',
            name='possible_parents',
            field=models.ManyToManyField(to='main.ParentDevice'),
        ),
        migrations.AddField(
            model_name='childdevice',
            name='type_of_device',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.DeviceType', verbose_name='Type'),
        ),
        migrations.CreateModel(
            name='EventReport',
            fields=[
            ],
            options={
                'proxy': True,
                'verbose_name_plural': 'Event report',
            },
            bases=('main.event',),
        ),
        migrations.AlterUniqueTogether(
            name='person',
            unique_together=set([('name_first', 'name_last')]),
        ),
        migrations.AlterUniqueTogether(
            name='childdevice',
            unique_together=set([('type_of_device', 'serial_number')]),
        ),
    ]
