Skip to content

Commit

Permalink
Add postgresql view for external reports into apartments table
Browse files Browse the repository at this point in the history
  • Loading branch information
indigane committed Sep 10, 2024
1 parent 98098d6 commit 1298329
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions backend/hitas/migrations/0016_external_report_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 4.2.4 on 2024-09-09 07:22

from django.db import migrations

CREATE_SQL = """
CREATE VIEW hitas_apartment_external_report_view AS
SELECT
id,
deleted,
deleted_by_cascade,
uuid,
share_number_start,
share_number_end,
completion_date,
street_address,
stair,
apartment_number,
floor,
surface_area,
rooms,
catalog_purchase_price,
catalog_primary_loan_amount,
additional_work_during_construction,
loans_during_construction,
interest_during_construction_mpi,
interest_during_construction_cpi,
debt_free_purchase_price_during_construction,
apartment_type_id,
building_id,
updated_acquisition_price
FROM hitas_apartment;
COMMENT ON VIEW hitas_apartment_external_report_view IS
'hitas_apartment view for external report usage, excluding the notes column because notes may contain sensitive information.';
""" # noqa: E501

DROP_SQL = "DROP VIEW IF EXISTS hitas_apartment_external_report_view;"


class Migration(migrations.Migration):
dependencies = [
("hitas", "0015_housingcompanydocument_aparmentdocument"),
]

operations = [
migrations.RunSQL(
sql=CREATE_SQL,
reverse_sql=DROP_SQL,
),
]

0 comments on commit 1298329

Please sign in to comment.