text: # -*- coding: utf-8 -*-
  # Generated by Django 1.11.29 on 2021-02-25 11:19
  from __future__ import unicode_literals
  
  from django.db import migrations
  
  
  class Migration(migrations.Migration):
  
      ops = [
          (
              """
              DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_person_organization";
              """,
              """
              CREATE MATERIALIZED VIEW "public"."campusonline_person_organization" AS SELECT
                  person_nr::integer AS person_id,
                  org_nr::integer AS organization_id
              FROM "campusonline"."personen_organisationen"
              WITH DATA;
              """,
          ),
          (
              """
              ALTER FOREIGN TABLE "campusonline"."personen_organisationen" ADD COLUMN KARENZ varchar;
              """,
              """
              ALTER FOREIGN TABLE "campusonline"."personen_organisationen" DROP COLUMN KARENZ;
              """,
          ),
          (
              """
              CREATE MATERIALIZED VIEW "public"."campusonline_person_organization" AS SELECT
                  person_nr::integer AS person_id,
                  org_nr::integer AS organization_id
              FROM "campusonline"."personen_organisationen"
              WHERE karenz IS NULL
              WITH DATA;
              """,
              """
              DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_person_organization";
              """,
          ),
          (
              """
              CREATE MATERIALIZED VIEW "public"."campusonline_person_organization_leave" AS SELECT
                  person_nr::integer AS person_id,
                  org_nr::integer AS organization_id
              FROM "campusonline"."personen_organisationen"
              WHERE karenz IS NOT NULL
              WITH DATA;
              """,
              """
              DROP MATERIALIZED VIEW IF EXISTS "public"."campusonline_person_organization_leave";
              """,
          ),
      ]
  
      dependencies = [("campusonline", "0056_organization")]
  
      operations = [
          migrations.RunSQL(
              [forward for forward, reverse in ops],
              [reverse for forward, reverse in reversed(ops)],
          )
      ]
  