# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-14 14:32
from __future__ import unicode_literals

from django.db import migrations

from osf.models import MetaSchema
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION


def update_metaschema_active(*args, **kwargs):
    MetaSchema.objects.filter(schema_version__lt=LATEST_SCHEMA_VERSION).update(active=False)


class Migration(migrations.Migration):

    dependencies = [
        ('osf', '0054_add_file_version_indices'),
    ]

    operations = [
        migrations.RunPython(update_metaschema_active, ),
    ]

Update active metaschemas.