Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add postgresql view for external reports into apartments table #502

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
),
]
Loading