# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-09-06 16:40
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        ('bruv', '0031_auto_20170830_2222'),
    ]

    operations = [
        migrations.CreateModel(
            name='BaitContainer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(max_length=32)),
            ],
        ),

        migrations.RunSQL('''
                    BEGIN TRANSACTION;

                    INSERT INTO public.bruv_baitcontainer 
                    ( 
                      id,
                      type
                    )
                    values 
                    (
                      1,
                      'bag'                    
                    ),
                    (
                      2,
                      'cage'                    
                    );

                    COMMIT TRANSACTION;
                '''),

        migrations.AddField(
            model_name='equipment',
            name='container',
            field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='bruv.BaitContainer'),
            preserve_default=False,
        ),

        migrations.RunSQL('''
                        BEGIN TRANSACTION;

                        UPDATE public.bruv_equipment 
                        SET container_id = 2
                        WHERE bait_container = 'C';

                        COMMIT TRANSACTION;
                    '''),

        migrations.RemoveField(
            model_name='equipment',
            name='bait_container',
        ),
    ]
