# Generated by Django 2.1.2 on 2018-10-05 11:03

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [("coursera", "0017_create_assessment_view")]

    operations = [
        migrations.RunSQL(
            [
                """
                CREATE MATERIALIZED VIEW
                    assessment_responses_view
                AS
                SELECT
                    assessment_response_id,
                    assessment_id,
                    assessment_action_id,
                    assessment_action_version,
                    assessment_question_id,
                    assessment_response_score,
                    assessment_response_weighted_score
                FROM
                    assessment_responses
                """,
                """
                CREATE UNIQUE INDEX ON assessment_responses_view (assessment_response_id)
                """,
                """
                CREATE INDEX ON assessment_responses_view (assessment_id)
                """,
            ],
            reverse_sql="DROP MATERIALIZED VIEW IF EXISTS assessment_responses_view",
        )
    ]
