# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2019-02-15 18:44
from __future__ import unicode_literals

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


def ordenar_segun_id(apps, schema_editor):
    RutaSaliente = apps.get_model("configuracion_telefonia_app", "RutaSaliente")
    for ruta in RutaSaliente.objects.all():
        ruta.orden = ruta.id
        ruta.save()


def ignorar(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('configuracion_telefonia_app', '0004_auto_20190115_1559'),
    ]

    operations = [
        migrations.AddField(
            model_name='rutasaliente',
            name='orden',
            field=models.PositiveIntegerField(default=1),
        ),
        migrations.RunPython(ordenar_segun_id, ignorar),
        migrations.AlterField(
            model_name='rutasaliente',
            name='orden',
            field=models.PositiveIntegerField(
                default=configuracion_telefonia_app.models.max_orden_ruta_saliente, unique=True),
        ),
    ]
