# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-06 04:44
from __future__ import unicode_literals

from django.db import migrations
import mtp.apps.media.managers

def migrate_documents_to_media(apps, schema_editor):
    """Migrate the ``documents`` app models their ``media``app equivalent"""

    Media = apps.get_model(
        'media',
        'Media'
    )

    Media.objects.migrate_documents_to_media()


def noop_backward_func(apps, schema_editor):
    """No turning back"""

    pass


class Migration(migrations.Migration):

    dependencies = [
        ('media', '0004_change_media_to_one_to_one'),
    ]

    operations = [
        migrations.AlterModelManagers(
            name='media',
            managers=[
                ('objects', mtp.apps.media.managers.DependencyMediaManager()),
            ],
        ),
        migrations.RunPython(migrate_documents_to_media, noop_backward_func)
    ]
