<reponame>EBI-Metagenomics/ebi-metagenomics-api<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-07-15 16:31
from __future__ import unicode_literals

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


def rm_optional_keys(apps, schema_editor):
    ops = [
        'ALTER TABLE `SAMPLE_ANN` DROP PRIMARY KEY',
        'ALTER TABLE `SAMPLE_ANN` DROP UNIQUE KEY  `SAMPLE_ANN_PK`'
    ]
    for op in ops:
        try:
            migrations.RunSQL(sql=op)
        except Exception:
            pass


class Migration(migrations.Migration):
    dependencies = [
        ('emgapi', '0012_auto_20190507_1219'),
    ]

    operations = [
        migrations.AlterField(
            model_name='sampleann',
            name='sample',
            field=models.ForeignKey(db_column='SAMPLE_ID', on_delete=django.db.models.deletion.CASCADE, related_name='metadata', to='emgapi.Sample'),
        ),
        migrations.RunPython(rm_optional_keys),
        migrations.AlterUniqueTogether(
            name='sampleann',
            unique_together=set([]),
        ),
        migrations.AddField(
            model_name='sampleann',
            name='id',
            field=models.IntegerField(null=True),
        ),
        migrations.RunSQL(
            sql='SET @a:=0;UPDATE SAMPLE_ANN SET id=@a:=@a+1;',
        ),
        migrations.AlterField(
            model_name='sampleann',
            name='id',
            field=models.IntegerField(primary_key=True, serialize=False),
        ),
        migrations.AlterField(
            model_name='sampleann',
            name='id',
            field=models.AutoField(primary_key=True, serialize=False),
        ),
        migrations.AlterUniqueTogether(
            name='sampleann',
            unique_together=set([('sample', 'var')]),
        ),

    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-07-15 16:31
from __future__ import unicode_literals

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


def rm_optional_keys(apps, schema_editor):
    ops = [
        'ALTER TABLE `SAMPLE_ANN` DROP PRIMARY KEY',
        'ALTER TABLE `SAMPLE_ANN` DROP UNIQUE KEY  `SAMPLE_ANN_PK`'
    ]
    for op in ops:
        try:
            migrations.RunSQL(sql=op)
        except Exception:
            pass


class Migration(migrations.Migration):
    dependencies = [
        ('emgapi', '0012_auto_20190507_1219'),
    ]

    operations = [
        migrations.AlterField(
            model_name='sampleann',
            name='sample',
            field=models.ForeignKey(db_column='SAMPLE_ID', on_delete=django.db.models.deletion.CASCADE, related_name='metadata', to='emgapi.Sample'),
        ),
        migrations.RunPython(rm_optional_keys),
        migrations.AlterUniqueTogether(
            name='sampleann',
            unique_together=set([]),
        ),
        migrations.AddField(
            model_name='sampleann',
            name='id',
            field=models.IntegerField(null=True),
        ),
        migrations.RunSQL(
            sql='SET @a:=0;UPDATE SAMPLE_ANN SET id=@a:=@a+1;',
        ),
        migrations.AlterField(
            model_name='sampleann',
            name='id',
            field=models.IntegerField(primary_key=True, serialize=False),
        ),
        migrations.AlterField(
            model_name='sampleann',
            name='id',
            field=models.AutoField(primary_key=True, serialize=False),
        ),
        migrations.AlterUniqueTogether(
            name='sampleann',
            unique_together=set([('sample', 'var')]),
        ),

    ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2019-07-15 16:31