# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

    constraint_args = {
        'table': 'roleplays_step',
        'constraint': 'roleplays_step_sort_order_roleplay_id_key',
    }

    dependencies = [
        ('roleplays', '0020_change_constraints_for_orderable'),
    ]

    operations = [
        migrations.RunSQL(
            'ALTER TABLE %(table)s DROP CONSTRAINT %(constraint)s' % constraint_args,

            'ALTER TABLE %(table)s ADD CONSTRAINT "%(constraint)s" '
            'UNIQUE (sort_order, roleplay_id) DEFERRABLE INITIALLY DEFERRED;' % constraint_args,

        ),
        migrations.AlterUniqueTogether(
            name='step',
            unique_together=set([('sort_order', 'roleplay')]),
        ),
    ]
