# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-15 15:50
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations


class Migration(migrations.Migration):
    forward = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamp,
            LV_ENDE timestamp,
            RAUM_NR numeric,
            LERNEINHEIT varchar
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """.format(
            settings.MULTICORN.get("campusonline")
        ),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr::integer, lv_grp_nr::integer, pers_nr::integer) AS id,
            termin_nr::integer AS term,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            (lv_beginn AT TIME ZONE 'Europe/Vienna') ::timestamptz AS start,
            (lv_ende AT TIME ZONE 'Europe/Vienna') ::timestamptz AS end,
            raum_nr::integer AS room_id,
            lerneinheit as title
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_selection_idx ON "public"."campusonline_coursegroupterm" ("person_id", "room_id", "start", "end");
        """,
    ]

    reverse = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamptz,
            LV_ENDE timestamptz,
            RAUM_NR numeric
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """.format(
            settings.MULTICORN.get("campusonline")
        ),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr, lv_grp_nr, pers_nr) AS id,
            termin_nr::integer AS termroom_id,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            lv_beginn AS start,
            lv_ende AS end,
            raum_nr::integer AS room_id
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """,
        """
        CREATE INDEX
            campusonline_coursegroupterm_selection_idx
        ON
            "public"."campusonline_coursegroupterm"
        (
            "person_id",
            "room_id",
            "start",
            "end"
        );
        """,
    ]

    dependencies = [("campusonline", "0012_event")]

    operations = [migrations.RunSQL(forward, reverse)]

abba4c6260c46d0046520e823cc5b76e374395f2
<mask token>

<mask token>


class Migration(migrations.Migration):
    <mask token>
    <mask token>
    <mask token>
    <mask token>

<mask token>


class Migration(migrations.Migration):
    forward = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """
        ,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """
        ,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """
        ,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamp,
            LV_ENDE timestamp,
            RAUM_NR numeric,
            LERNEINHEIT varchar
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """
        .format(settings.MULTICORN.get('campusonline')),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr::integer, lv_grp_nr::integer, pers_nr::integer) AS id,
            termin_nr::integer AS term,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            (lv_beginn AT TIME ZONE 'Europe/Vienna') ::timestamptz AS start,
            (lv_ende AT TIME ZONE 'Europe/Vienna') ::timestamptz AS end,
            raum_nr::integer AS room_id,
            lerneinheit as title
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_selection_idx ON "public"."campusonline_coursegroupterm" ("person_id", "room_id", "start", "end");
        """
        ]
    reverse = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """
        ,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """
        ,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """
        ,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamptz,
            LV_ENDE timestamptz,
            RAUM_NR numeric
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """
        .format(settings.MULTICORN.get('campusonline')),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr, lv_grp_nr, pers_nr) AS id,
            termin_nr::integer AS termroom_id,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            lv_beginn AS start,
            lv_ende AS end,
            raum_nr::integer AS room_id
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """
        ,
        """
        CREATE INDEX
            campusonline_coursegroupterm_selection_idx
        ON
            "public"."campusonline_coursegroupterm"
        (
            "person_id",
            "room_id",
            "start",
            "end"
        );
        """
        ]
    dependencies = [('campusonline', '0012_event')]
    operations = [migrations.RunSQL(forward, reverse)]

from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations


class Migration(migrations.Migration):
    forward = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """
        ,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """
        ,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """
        ,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamp,
            LV_ENDE timestamp,
            RAUM_NR numeric,
            LERNEINHEIT varchar
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """
        .format(settings.MULTICORN.get('campusonline')),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr::integer, lv_grp_nr::integer, pers_nr::integer) AS id,
            termin_nr::integer AS term,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            (lv_beginn AT TIME ZONE 'Europe/Vienna') ::timestamptz AS start,
            (lv_ende AT TIME ZONE 'Europe/Vienna') ::timestamptz AS end,
            raum_nr::integer AS room_id,
            lerneinheit as title
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_selection_idx ON "public"."campusonline_coursegroupterm" ("person_id", "room_id", "start", "end");
        """
        ]
    reverse = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """
        ,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """
        ,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """
        ,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """
        ,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamptz,
            LV_ENDE timestamptz,
            RAUM_NR numeric
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """
        .format(settings.MULTICORN.get('campusonline')),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr, lv_grp_nr, pers_nr) AS id,
            termin_nr::integer AS termroom_id,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            lv_beginn AS start,
            lv_ende AS end,
            raum_nr::integer AS room_id
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """
        ,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """
        ,
        """
        CREATE INDEX
            campusonline_coursegroupterm_selection_idx
        ON
            "public"."campusonline_coursegroupterm"
        (
            "person_id",
            "room_id",
            "start",
            "end"
        );
        """
        ]
    dependencies = [('campusonline', '0012_event')]
    operations = [migrations.RunSQL(forward, reverse)]

# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-15 15:50
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations


class Migration(migrations.Migration):
    forward = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamp,
            LV_ENDE timestamp,
            RAUM_NR numeric,
            LERNEINHEIT varchar
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """.format(
            settings.MULTICORN.get("campusonline")
        ),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr::integer, lv_grp_nr::integer, pers_nr::integer) AS id,
            termin_nr::integer AS term,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            (lv_beginn AT TIME ZONE 'Europe/Vienna') ::timestamptz AS start,
            (lv_ende AT TIME ZONE 'Europe/Vienna') ::timestamptz AS end,
            raum_nr::integer AS room_id,
            lerneinheit as title
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_selection_idx ON "public"."campusonline_coursegroupterm" ("person_id", "room_id", "start", "end");
        """,
    ]

    reverse = [
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_selection_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_person_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_room_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_timerange_idx;
        """,
        """
        DROP INDEX IF EXISTS campusonline_coursegroupterm_id_idx;
        """,
        """
        DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_coursegroupterm";
        """,
        """
        DROP FOREIGN TABLE IF EXISTS "campusonline"."lv_grp_term";
        """,
        """
        CREATE FOREIGN TABLE "campusonline"."lv_grp_term" (
            LV_GRP_NR numeric,
            PERS_NR numeric,
            TERMIN_NR numeric,
            LV_BEGINN timestamptz,
            LV_ENDE timestamptz,
            RAUM_NR numeric
        )
        SERVER sqlalchemy OPTIONS (
            tablename 'LV_GRP_TERM_V',
            db_url '{}'
        );
        """.format(
            settings.MULTICORN.get("campusonline")
        ),
        """
        CREATE MATERIALIZED VIEW "public"."campusonline_coursegroupterm" AS SELECT
            format('%s-%s-%s', termin_nr, lv_grp_nr, pers_nr) AS id,
            termin_nr::integer AS termroom_id,
            lv_grp_nr::integer AS coursegroup_id,
            pers_nr::integer AS person_id,
            lv_beginn AS start,
            lv_ende AS end,
            raum_nr::integer AS room_id
        FROM "campusonline"."lv_grp_term"
        WITH DATA;
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_id_idx ON "public"."campusonline_coursegroupterm" ("id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_timerange_idx ON "public"."campusonline_coursegroupterm" ("start", "end");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_room_idx ON "public"."campusonline_coursegroupterm" ("room_id");
        """,
        """
        CREATE INDEX campusonline_coursegroupterm_person_idx ON "public"."campusonline_coursegroupterm" ("person_id");
        """,
        """
        CREATE INDEX
            campusonline_coursegroupterm_selection_idx
        ON
            "public"."campusonline_coursegroupterm"
        (
            "person_id",
            "room_id",
            "start",
            "end"
        );
        """,
    ]

    dependencies = [("campusonline", "0012_event")]

    operations = [migrations.RunSQL(forward, reverse)]
