-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add postgresql view for external reports into apartments table
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
] |