# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-16 20:20
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.RunSQL("""CREATE VIEW phenotype AS
                SELECT DISTINCT
                    ou.cropdbid,
                    ou.observationunitdbid,
                    ou.name AS observationunitname,
                    ou.entrynumber,
                    ou.entrytype,
                    s.studydbid,
                    s.locationdbid,
                    s.studyname AS studyname,
                    l.name AS locationname,
                    ou.observationlevel,
                    ou.observationlevels,
                    ou.plotnumber,
                    ou.plantnumber,
                    ou.blocknumber,
                    ou.replicate,
                    p.programdbid,
                    p.name AS programname,
                    ou.germplasmdbid,
                    g.germplasmname,
                    ou.x,
                    ou.y
                FROM observation_unit ou
                    INNER JOIN study s ON ou.studydbid = s.studydbid
                    INNER JOIN location l ON s.locationdbid = l.locationdbid
                    INNER JOIN program p ON p.programdbid = ou.programdbid
                    INNER JOIN germplasm g ON ou.germplasmdbid = g.germplasmdbid;"""),
        migrations.CreateModel(
            name='AlleleMatrix',
            fields=[
                ('name', models.CharField(blank=True, default='', max_length=100)),
                ('matrixDbId', models.IntegerField(db_column='matrixdbid', primary_key=True, serialize=False)),
                ('description', models.CharField(blank=True, default='', max_length=100)),
                ('lastUpdated', models.DateField(db_column='lastupdated')),
                ('studyDbId', models.IntegerField(db_column='studydbid')),
            ],
            options={
                'db_table': 'allelematrix',
                'ordering': ('matrixDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Call',
            fields=[
                ('calldbid', models.TextField(primary_key=True, serialize=False)),
                ('call', models.TextField(blank=True, null=True)),
                ('datatypes', models.TextField(blank=True, null=True)),
                ('methods', models.TextField(blank=True, null=True)),
            ],
            options={
                'db_table': 'call',
                'ordering': ('calldbid',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('contactDbId', models.TextField(db_column='contactdbid', default='', primary_key=True, serialize=False)),
                ('name', models.TextField(blank=True, null=True)),
                ('email', models.TextField(blank=True, null=True)),
                ('type', models.TextField(blank=True, null=True)),
                ('orcid', models.TextField(blank=True, null=True)),
                ('instituteName', models.TextField(blank=True, db_column='institutename', null=True)),
            ],
            options={
                'db_table': 'contact',
                'ordering': ('contactDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Crop',
            fields=[
                ('cropdbid', models.TextField(primary_key=True, serialize=False)),
                ('commonname', models.TextField()),
            ],
            options={
                'db_table': 'crop',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Donor',
            fields=[
                ('donorAccessionNumber', models.TextField(blank=True, db_column='donoraccessionnumber', null=True)),
                ('donorInstituteCode', models.TextField(blank=True, db_column='', null=True)),
                ('donorGermplasmPUI', models.TextField(blank=True, db_column='', null=True)),
                ('donordbid', models.TextField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'donor',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Germplasm',
            fields=[
                ('germplasmDbId', models.TextField(db_column='germplasmdbid', default='', primary_key=True, serialize=False)),
                ('germplasmPUI', models.TextField(blank=True, db_column='germplasmpui', null=True)),
                ('germplasmName', models.TextField(db_column='germplasmname', default='')),
                ('defaultDisplayName', models.TextField(db_column='defaultdisplayname', default='')),
                ('accessionNumber', models.TextField(blank=True, db_column='accessionnumber', null=True)),
                ('pedigree', models.TextField(blank=True, null=True)),
                ('seedSource', models.TextField(blank=True, db_column='seedsource', null=True)),
                ('synonyms', models.TextField(blank=True, null=True)),
                ('instituteCode', models.TextField(db_column='institutecode', default='')),
                ('instituteName', models.TextField(blank=True, db_column='institutename', null=True)),
                ('biologicalStatusOfAccessionCode', models.TextField(blank=True, db_column='biologicalstatusofaccessioncode', null=True)),
                ('countryOfOriginCode', models.TextField(blank=True, db_column='countryoforigincode', null=True)),
                ('typeOfGermplasmStorageCode', models.TextField(blank=True, db_column='typeofgermplasmstoragecode', null=True)),
                ('genus', models.TextField(blank=True, null=True)),
                ('commonCropName', models.TextField(blank=True, db_column='commoncropname', null=True)),
                ('species', models.TextField(blank=True, null=True)),
                ('speciesAuthority', models.TextField(blank=True, db_column='speciesauthority', null=True)),
                ('subtaxa', models.TextField(blank=True, db_column='subtaxa', null=True)),
                ('subtaxaAuthority', models.TextField(blank=True, db_column='subtaxaauthority', null=True)),
                ('acquisitionDate', models.DateField(blank=True, db_column='acquisitiondate', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'germplasm',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='GermplasmAttribute',
            fields=[
                ('attributeDbId', models.TextField(db_column='attributedbid', default='', primary_key=True, serialize=False)),
                ('code', models.TextField(blank=True, null=True)),
                ('uri', models.TextField(blank=True, null=True)),
                ('name', models.TextField()),
                ('description', models.TextField(blank=True, null=True)),
                ('datatype', models.TextField(blank=True, null=True)),
                ('values', models.TextField(blank=True, null=True)),
            ],
            options={
                'db_table': 'germplasm_attribute',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='GermplasmAttributeCategory',
            fields=[
                ('attributeCategoryDbId', models.TextField(db_column='attributecategorydbid', default='', primary_key=True, serialize=False)),
                ('name', models.TextField(blank=True, db_column='attributecategoryname', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'germplasm_attribute_category',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='GermplasmAttributeValue',
            fields=[
                ('determinedDate', models.DateField(blank=True, db_column='determineddate', null=True)),
                ('value', models.TextField()),
                ('attributeCode', models.TextField(blank=True, db_column='attributecode', null=True)),
                ('attributeName', models.TextField(blank=True, db_column='attributename', null=True)),
                ('germplasmattributevaluedbid', models.TextField(primary_key=True, serialize=False)),
                ('attributeDbId', models.ForeignKey(db_column='attributedbid', default='', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.GermplasmAttribute')),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('germplasmDbId', models.ForeignKey(db_column='germplasmdbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Germplasm')),
            ],
            options={
                'db_table': 'germplasm_attribute_value',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('locationDbId', models.TextField(db_column='locationdbid', primary_key=True, serialize=False)),
                ('type', models.TextField(blank=True, null=True)),
                ('name', models.TextField(blank=True, null=True)),
                ('abbreviation', models.TextField(blank=True, null=True)),
                ('countryCode', models.TextField(blank=True, db_column='countrycode', null=True)),
                ('countryName', models.TextField(blank=True, db_column='countryname', null=True)),
                ('latitude', models.FloatField(blank=True, null=True)),
                ('longitude', models.FloatField(blank=True, null=True)),
                ('altitude', models.FloatField(blank=True, null=True)),
                ('instituteName', models.TextField(blank=True, db_column='institutename', null=True)),
                ('instituteAddress', models.TextField(blank=True, db_column='instituteaddress', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'location',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='LocationAdditionalInfo',
            fields=[
                ('key', models.TextField()),
                ('value', models.TextField()),
                ('locationaddinfodbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('locationdbid', models.ForeignKey(blank=True, db_column='locationdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='additionalInfo', to='brapi.Location')),
            ],
            options={
                'db_table': 'location_additional_info',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Map',
            fields=[
                ('mapDbId', models.IntegerField(default='', primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=100, null=True)),
                ('species', models.CharField(blank=True, max_length=100, null=True)),
                ('type', models.CharField(blank=True, max_length=100, null=True)),
                ('unit', models.CharField(blank=True, max_length=100, null=True)),
                ('publishedDate', models.DateField(blank=True, null=True)),
                ('comments', models.CharField(blank=True, max_length=100, null=True)),
            ],
            options={
                'db_table': 'map',
                'ordering': ('mapDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='MapLinkage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('markerDbId', models.IntegerField()),
                ('markerName', models.CharField(blank=True, max_length=100, null=True)),
                ('location', models.IntegerField()),
                ('linkageGroupId', models.IntegerField()),
                ('mapDbId', models.ForeignKey(db_column='mapDbId', default='', on_delete=django.db.models.deletion.CASCADE, related_name='linkageGroups', to='brapi.Map')),
            ],
            options={
                'db_table': 'map_linkage',
                'ordering': ('id',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Marker',
            fields=[
                ('markerDbId', models.IntegerField(db_column='markerdbid', primary_key=True, serialize=False)),
                ('defaultDisplayName', models.TextField(blank=True, db_column='defaultdisplayname', null=True)),
                ('type', models.TextField(blank=True, null=True)),
                ('synonyms', models.TextField(blank=True, null=True)),
                ('refAlt', models.TextField(blank=True, db_column='refalt', null=True)),
                ('analysisMethods', models.TextField(blank=True, db_column='analysismethods', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'marker',
                'ordering': ('markerDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Markerprofile',
            fields=[
                ('markerprofileDbId', models.IntegerField(db_column='markerprofiledbid', primary_key=True, serialize=False)),
                ('uniqueDisplayName', models.CharField(blank=True, db_column='uniquedisplayname', default='', max_length=100)),
                ('sampleDbId', models.IntegerField(db_column='sampledbid')),
                ('extractDbId', models.IntegerField(db_column='extractdbid')),
                ('analysisMethod', models.CharField(blank=True, db_column='analysismethod', default='', max_length=100)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('germplasmDbId', models.ForeignKey(db_column='germplasmdbid', default='', on_delete=django.db.models.deletion.CASCADE, related_name='mprofiles-details+', to='brapi.Germplasm')),
            ],
            options={
                'db_table': 'markerprofile',
                'ordering': ('markerprofileDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='MarkerprofileData',
            fields=[
                ('alleleCall', models.CharField(blank=True, db_column='allelecall', default='', max_length=100)),
                ('markerprofilesdatadbid', models.TextField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('markerDbId', models.ForeignKey(blank=True, db_column='markerdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Marker')),
                ('markerprofileDbId', models.ForeignKey(blank=True, db_column='markerprofiledbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Markerprofile')),
            ],
            options={
                'db_table': 'markerprofilesdata',
                'ordering': ('markerprofilesdatadbid',),
            },
        ),
        migrations.CreateModel(
            name='Method',
            fields=[
                ('methodDbId', models.TextField(db_column='methoddbid', default='', primary_key=True, serialize=False)),
                ('name', models.TextField(blank=True, null=True)),
                ('classis', models.TextField(blank=True, db_column='class', null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('formula', models.TextField(blank=True, null=True)),
                ('reference', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'method',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Observation',
            fields=[
                ('observationDbId', models.TextField(db_column='observationdbid', default='', primary_key=True, serialize=False)),
                ('observationTimestamp', models.TextField(blank=True, db_column='observationtimestamp', null=True)),
                ('collector', models.TextField(blank=True, null=True)),
                ('uploadedBy', models.TextField(blank=True, db_column='uploadedby', null=True)),
                ('value', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'observation',
                'ordering': ('observationDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ObservationUnit',
            fields=[
                ('observationUnitDbId', models.TextField(db_column='observationunitdbid', default='', primary_key=True, serialize=False)),
                ('observationUnitName', models.TextField(db_column='name', default='')),
                ('observationLevel', models.TextField(blank=True, db_column='observationlevel', null=True)),
                ('observationLevels', models.TextField(blank=True, db_column='observationlevels', null=True)),
                ('entryNumber', models.TextField(blank=True, db_column='entrynumber', null=True)),
                ('entryType', models.TextField(blank=True, db_column='entrytype', null=True)),
                ('plotNumber', models.TextField(blank=True, db_column='plotnumber', null=True)),
                ('blockNumber', models.TextField(blank=True, db_column='blocknumber', null=True)),
                ('plantNumber', models.TextField(blank=True, db_column='plantnumber', null=True)),
                ('X', models.IntegerField(blank=True, db_column='x', null=True)),
                ('Y', models.IntegerField(blank=True, db_column='y', null=True)),
                ('replicate', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('germplasmDbId', models.ForeignKey(db_column='germplasmdbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Germplasm')),
            ],
            options={
                'db_table': 'observation_unit',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ObservationUnitAdditionalInfo',
            fields=[
                ('key', models.TextField()),
                ('value', models.TextField()),
                ('observationunitadditionalinfodbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('observationunitdbid', models.ForeignKey(blank=True, db_column='trialdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='observationunitdbid', to='brapi.ObservationUnit')),
            ],
            options={
                'db_table': 'observation_unit_additional_info',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ObservationUnitXref',
            fields=[
                ('source', models.TextField()),
                ('identifier', models.TextField()),
                ('observationunitxrefdbid', models.TextField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('observationunitdbid', models.ForeignKey(db_column='observationunitdbid', on_delete=django.db.models.deletion.DO_NOTHING, related_name='observationUnitXref', to='brapi.ObservationUnit')),
            ],
            options={
                'db_table': 'observation_unit_xref',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ObservationVariable',
            fields=[
                ('observationVariableDbId', models.TextField(db_column='observationvariabledbid', default='', primary_key=True, serialize=False)),
                ('observationVariableName', models.TextField(blank=True, db_column='observationvariablename', null=True)),
                ('synonyms', models.TextField(blank=True, null=True)),
                ('contextOfUse', models.TextField(blank=True, db_column='contextofuse', null=True)),
                ('status', models.TextField(blank=True, null=True)),
                ('xref', models.TextField(blank=True, null=True)),
                ('institution', models.TextField(blank=True, null=True)),
                ('scientist', models.TextField(blank=True, null=True)),
                ('submissionTimestamp', models.DateTimeField(blank=True, db_column='submissiontimestamp', null=True)),
                ('language', models.TextField(blank=True, null=True)),
                ('growthStage', models.TextField(blank=True, null=True)),
                ('defaultValue', models.TextField(blank=True, db_column='defaultvalue', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('methodDbId', models.ForeignKey(blank=True, db_column='methoddbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Method')),
            ],
            options={
                'db_table': 'observation_variable',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ObservationVariableDatatype',
            fields=[
                ('observationvariabledatatypedbid', models.IntegerField(db_column='observationvariabledatatypedbid', primary_key=True, serialize=False)),
                ('data', models.TextField(blank=True, default='')),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'observation_variable_datatype',
                'ordering': ('observationvariabledatatypedbid',),
            },
        ),
        migrations.CreateModel(
            name='Ontology',
            fields=[
                ('ontologyDbId', models.TextField(db_column='ontologydbid', default='', primary_key=True, serialize=False)),
                ('ontologyName', models.TextField(blank=True, db_column='ontologyname', null=True)),
                ('authors', models.TextField(blank=True, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('version', models.TextField(blank=True, null=True)),
                ('copyright', models.TextField(blank=True, null=True)),
                ('licence', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'ontology',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Pedigree',
            fields=[
                ('pedigree', models.TextField()),
                ('defaultDisplayName', models.TextField(blank=True, db_column='defaultdisplayname', null=True)),
                ('pedigreeDbId', models.TextField(db_column='pedigreedbid', primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('germplasmDbId', models.ForeignKey(db_column='germplasmdbid', on_delete=django.db.models.deletion.DO_NOTHING, related_name='germplasm', to='brapi.Germplasm')),
                ('parent1DbId', models.ForeignKey(db_column='parent1dbid', on_delete=django.db.models.deletion.DO_NOTHING, related_name='parents1', to='brapi.Germplasm')),
                ('parent2DbId', models.ForeignKey(db_column='parent2dbid', on_delete=django.db.models.deletion.DO_NOTHING, related_name='parents2', to='brapi.Germplasm')),
            ],
            options={
                'db_table': 'pedigree',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Program',
            fields=[
                ('programDbId', models.TextField(db_column='programdbid', default='', primary_key=True, serialize=False)),
                ('name', models.TextField()),
                ('abbreviation', models.TextField(blank=True, null=True)),
                ('objective', models.TextField(blank=True, null=True)),
                ('leadPerson', models.TextField(blank=True, db_column='leadperson', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'program',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Sample',
            fields=[
                ('sampleDbId', models.TextField(db_column='sampledbid', primary_key=True, serialize=False)),
                ('plotId', models.CharField(blank=True, db_column='plotid', default='', max_length=100)),
                ('plantId', models.CharField(blank=True, db_column='plantid', default='', max_length=100)),
                ('sampleId', models.CharField(blank=True, db_column='sampleid', default='', max_length=100)),
                ('takenBy', models.CharField(blank=True, db_column='takenby', default='', max_length=100)),
                ('sampleTimestamp', models.DateTimeField(blank=True, db_column='sampletimestamp', default='', max_length=100)),
                ('sampleType', models.CharField(blank=True, db_column='sampletype', default='', max_length=100)),
                ('tissueType', models.CharField(blank=True, db_column='tissuetype', default='', max_length=100)),
                ('notes', models.CharField(blank=True, default='', max_length=100)),
                ('plantingTimestamp', models.DateTimeField(db_column='plantingtimestamp')),
                ('harvestTimestamp', models.DateTimeField(db_column='harvesttimestamp')),
                ('cropDbId', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('germplasmDbId', models.ForeignKey(blank=True, db_column='germplasmdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Germplasm')),
                ('locationDbId', models.ForeignKey(blank=True, db_column='locationdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Location')),
                ('observationUnitDbId', models.ForeignKey(blank=True, db_column='observationunitdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.ObservationUnit')),
            ],
            options={
                'db_table': 'sample',
                'ordering': ('sampleDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Scale',
            fields=[
                ('scaleDbId', models.TextField(db_column='scaledbid', default='', primary_key=True, serialize=False)),
                ('name', models.TextField(default='')),
                ('decimalPlaces', models.IntegerField(db_column='decimalplaces', default=0)),
                ('xref', models.TextField(blank=True, null=True)),
                ('defaultValue', models.TextField(blank=True, db_column='', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('datatypeDbId', models.ForeignKey(blank=True, db_column='data', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.ObservationVariableDatatype')),
            ],
            options={
                'db_table': 'scale',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Season',
            fields=[
                ('seasonDbId', models.TextField(db_column='seasondbid', default='', primary_key=True, serialize=False)),
                ('year', models.TextField(blank=True, null=True)),
                ('season', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'season',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Study',
            fields=[
                ('studyDbId', models.TextField(db_column='studydbid', default='', primary_key=True, serialize=False)),
                ('studyName', models.TextField(db_column='studyname', default='')),
                ('studyDescription', models.TextField(blank=True, db_column='description', null=True)),
                ('startDate', models.DateField(blank=True, db_column='startdate', null=True)),
                ('endDate', models.DateField(blank=True, db_column='enddate', null=True)),
                ('active', models.NullBooleanField()),
                ('license', models.TextField(blank=True, null=True)),
                ('lastUpdateVersion', models.TextField(blank=True, db_column='lastupdateversion', null=True)),
                ('lastUpdateTimestamp', models.DateTimeField(blank=True, db_column='lastupdatetimestamp', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('locationDbId', models.ForeignKey(blank=True, db_column='locationdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='locations', to='brapi.Location')),
            ],
            options={
                'db_table': 'study',
                'ordering': ('studyDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='StudyAdditionalInfo',
            fields=[
                ('key', models.TextField()),
                ('value', models.TextField()),
                ('studyadditionalinfodbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('studyDbId', models.ForeignKey(blank=True, db_column='studydbid', default='', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Study')),
            ],
            options={
                'db_table': 'study_additional_info',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='StudyContact',
            fields=[
                ('studycontactdbid', models.IntegerField(primary_key=True, serialize=False)),
                ('contactdbid', models.ForeignKey(db_column='contactdbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Contact')),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('studydbid', models.ForeignKey(db_column='studydbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Study')),
            ],
            options={
                'db_table': 'study_contact',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='StudyDataLink',
            fields=[
                ('name', models.TextField(blank=True, null=True)),
                ('type', models.TextField(blank=True, null=True)),
                ('url', models.TextField()),
                ('studydatalinkdbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('studydbid', models.ForeignKey(db_column='studydbid', on_delete=django.db.models.deletion.DO_NOTHING, related_name='dataLinks', to='brapi.Study')),
            ],
            options={
                'db_table': 'study_data_link',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='StudyObservationLevel',
            fields=[
                ('studyobservationleveldbid', models.IntegerField(primary_key=True, serialize=False)),
                ('data', models.TextField(blank=True, default='')),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'study_observation_level',
                'ordering': ('studyobservationleveldbid',),
            },
        ),
        migrations.CreateModel(
            name='StudySeason',
            fields=[
                ('studyseasondbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('seasonDbId', models.ForeignKey(db_column='seasondbid', default='', on_delete=django.db.models.deletion.DO_NOTHING, related_name='seasons1', to='brapi.Season')),
                ('studyDbId', models.ForeignKey(db_column='studydbid', default='', on_delete=django.db.models.deletion.DO_NOTHING, related_name='seasons', to='brapi.Study')),
            ],
            options={
                'db_table': 'study_season',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='StudyType',
            fields=[
                ('name', models.TextField(primary_key=True, serialize=False)),
                ('description', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'study_type',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='TaxonXref',
            fields=[
                ('taxondbid', models.TextField(primary_key=True, serialize=False)),
                ('source', models.TextField()),
                ('rank', models.TextField(blank=True, null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'taxon_xref',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='TaxonXrefGermplasm',
            fields=[
                ('taxonxrefgermplasmdbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('germplasmDbId', models.ForeignKey(blank=True, db_column='germplasmdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='germplasm1', to='brapi.Germplasm')),
                ('taxondbid', models.ForeignKey(blank=True, db_column='taxondbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='taxa', to='brapi.TaxonXref')),
            ],
            options={
                'db_table': 'taxon_xref_germplasm',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Trait',
            fields=[
                ('traitDbId', models.TextField(db_column='traitdbid', primary_key=True, serialize=False)),
                ('traitId', models.TextField(blank=True, db_column='traitid', null=True)),
                ('name', models.TextField(blank=True, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('classis', models.TextField(blank=True, null=True)),
                ('synonyms', models.TextField(blank=True, null=True)),
                ('mainAbbreviation', models.TextField(blank=True, db_column='mainabbreviation', null=True)),
                ('alternativeAbbreviations', models.TextField(blank=True, db_column='alternativeabbreviations', null=True)),
                ('entity', models.TextField(blank=True, null=True)),
                ('attribute', models.TextField(blank=True, null=True)),
                ('status', models.TextField(blank=True, null=True)),
                ('xref', models.TextField(blank=True, null=True)),
                ('defaultValue', models.CharField(blank=True, db_column='defaultvalue', default='', max_length=100)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'trait',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Treatment',
            fields=[
                ('factor', models.TextField()),
                ('modality', models.TextField()),
                ('treatmentdbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('observationUnitDbId', models.ForeignKey(db_column='observationunitdbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.ObservationUnit')),
            ],
            options={
                'db_table': 'treatment',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Trial',
            fields=[
                ('trialDbId', models.TextField(db_column='trialdbid', default='', primary_key=True, serialize=False)),
                ('trialName', models.TextField(db_column='name', default='')),
                ('startDate', models.DateField(blank=True, db_column='startdate', null=True)),
                ('endDate', models.DateField(blank=True, db_column='enddate', null=True)),
                ('active', models.NullBooleanField()),
                ('datasetAuthorshipLicence', models.TextField(blank=True, db_column='datasetauthorshiplicence', null=True)),
                ('datasetAuthorshipDatasetPUI', models.TextField(blank=True, db_column='datasetauthorshipdatasetpui', null=True)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('programDbId', models.ForeignKey(blank=True, db_column='programdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Program')),
            ],
            options={
                'db_table': 'trial',
                'ordering': ('trialDbId',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='TrialAdditionalInfo',
            fields=[
                ('key', models.TextField()),
                ('value', models.TextField()),
                ('trialadditionalinfodbid', models.IntegerField(primary_key=True, serialize=False)),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('trialdbid', models.ForeignKey(blank=True, db_column='trialdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='additionalInfo', to='brapi.Trial')),
            ],
            options={
                'db_table': 'trial_additional_info',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='TrialContact',
            fields=[
                ('trialcontactdbid', models.IntegerField(primary_key=True, serialize=False)),
                ('contactdbid', models.ForeignKey(blank=True, db_column='contactdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='contacts1', to='brapi.Contact')),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
                ('trialdbid', models.ForeignKey(blank=True, db_column='trialdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='contacts', to='brapi.Trial')),
            ],
            options={
                'db_table': 'trial_contact',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ValidValue',
            fields=[
                ('min', models.IntegerField(db_column='min')),
                ('max', models.IntegerField(db_column='max')),
                ('validValueDbId', models.TextField(db_column='validvaluedbid', primary_key=True, serialize=False)),
                ('categories', models.TextField()),
                ('cropdbid', models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop')),
            ],
            options={
                'db_table': 'validvalue',
                'managed': True,
            },
        ),
        migrations.AddField(
            model_name='study',
            name='studyType',
            field=models.ForeignKey(blank=True, db_column='studytype', default='', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='studies', to='brapi.StudyType'),
        ),
        migrations.AddField(
            model_name='study',
            name='trialDbId',
            field=models.ForeignKey(db_column='trialdbid', on_delete=django.db.models.deletion.DO_NOTHING, related_name='studies', to='brapi.Trial'),
        ),
        migrations.AddField(
            model_name='scale',
            name='validValues',
            field=models.ForeignKey(blank=True, db_column='vvalueid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.ValidValue'),
        ),
        migrations.AddField(
            model_name='sample',
            name='seasonDbId',
            field=models.ForeignKey(blank=True, db_column='seasondbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Season'),
        ),
        migrations.AddField(
            model_name='sample',
            name='studyDbId',
            field=models.ForeignKey(blank=True, db_column='studydbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Study'),
        ),
        migrations.AddField(
            model_name='observationvariable',
            name='ontologyDbId',
            field=models.ForeignKey(db_column='ontologydbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Ontology'),
        ),
        migrations.AddField(
            model_name='observationvariable',
            name='scales',
            field=models.ForeignKey(blank=True, db_column='scaledbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Scale'),
        ),
        migrations.AddField(
            model_name='observationvariable',
            name='traitDbId',
            field=models.ForeignKey(blank=True, db_column='traitdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='observationVariables', to='brapi.Trait'),
        ),
        migrations.AddField(
            model_name='observationunit',
            name='programDbId',
            field=models.ForeignKey(db_column='programdbid', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Program'),
        ),
        migrations.AddField(
            model_name='observationunit',
            name='studyDbId',
            field=models.ForeignKey(db_column='studydbid', default='', on_delete=django.db.models.deletion.DO_NOTHING, related_name='studies', to='brapi.Study'),
        ),
        migrations.AddField(
            model_name='observation',
            name='obsVariable',
            field=models.ForeignKey(blank=True, db_column='observationvariabledbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='obsVariable', to='brapi.ObservationVariable'),
        ),
        migrations.AddField(
            model_name='observation',
            name='observationUnit',
            field=models.ForeignKey(blank=True, db_column='observationunitdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='observations', to='brapi.ObservationUnit'),
        ),
        migrations.AddField(
            model_name='observation',
            name='seasonDbId',
            field=models.ForeignKey(blank=True, db_column='seasondbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Season'),
        ),
        migrations.AddField(
            model_name='markerprofile',
            name='studyDbId',
            field=models.ForeignKey(blank=True, db_column='studydbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Study'),
        ),
        migrations.AddField(
            model_name='germplasmattribute',
            name='attributeCategoryDbId',
            field=models.ForeignKey(db_column='attributecategorydbid', default='', on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.GermplasmAttributeCategory'),
        ),
        migrations.AddField(
            model_name='germplasmattribute',
            name='cropdbid',
            field=models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop'),
        ),
        migrations.AddField(
            model_name='donor',
            name='germplasmDbId',
            field=models.ForeignKey(blank=True, db_column='germplasmdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='donors', to='brapi.Germplasm'),
        ),
        migrations.AddField(
            model_name='contact',
            name='cropdbid',
            field=models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop'),
        ),
        migrations.AddField(
            model_name='call',
            name='cropdbid',
            field=models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop'),
        ),
        migrations.AddField(
            model_name='allelematrix',
            name='cropdbid',
            field=models.ForeignKey(blank=True, db_column='cropdbid', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='brapi.Crop'),
        ),
    ]
