# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-10 21:53
from __future__ import unicode_literals

from django.db import migrations


SQL = """
UPDATE core_projectstatus
SET has_metrics = (2>1)
WHERE EXISTS (
    SELECT 1
    FROM core_metric
    JOIN core_testrun ON core_testrun.id = core_metric.test_run_id
    WHERE core_testrun.build_id = core_projectstatus.build_id
)
"""


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0057_projectstatus_has_metrics'),
    ]

    operations = [
        migrations.RunSQL(
            SQL,
            reverse_sql=migrations.RunSQL.noop,
        ),
    ]
