# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-08-24 08:31
from __future__ import unicode_literals

from django.db import migrations
from django.db.migrations import SeparateDatabaseAndState

TABLES = [
    'Activity',
    'ValueType',
    'Title',
    'Location',
    'Transaction',

    'VerificationStatus',

    'BudgetIdentifier',
    'BudgetIdentifierSector',
    'BudgetIdentifierSectorCategory',
    'BudgetIdentifierVocabulary',

    'ContactType',
    'CountryBudgetItem',
    'CrsAdd',
    'CrsAddLoanStatus',
    'CrsAddLoanTerms',
    'Ffs',
    'FfsForecast',

    'GeographicVocabulary',
    'GeographicalPrecision',
    'GazetteerAgency',
    'GeographicLocationReach',
    'GeographicExactness',

    'LoanRepaymentPeriod',
    'LoanRepaymentType',
    'OrganisationIdentifier',
    'OrganisationRegistrationAgency',
    'PublisherType',
]


def move_table(model, dest='aims'):
    """
    Return an operation which will move the database table
    """
    return SeparateDatabaseAndState(
        [migrations.AlterModelTable(model, '%s_%s' % (dest, model.lower()))],  # This first parameter affects the database only
    )


class Migration(migrations.Migration):

    dependencies = [
        ('iati', '0022_iati_to_aims_drop'),
        ('aims', '0043_iati_to_aims_premove'),
    ]

    operations = [move_table(t) for t in TABLES]
