Skip to content

Commit

Permalink
fix(suspicious): create or replace views instead of drop create
Browse files Browse the repository at this point in the history
  • Loading branch information
jvandaal authored and ArneD committed Aug 1, 2024
1 parent 1c73a69 commit 8f19c38
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<ActiveAddresLinkedToMultipleBuildingUnit
public const string ViewName = "view_active_address_linked_to_multiple_building_units";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id as varchar) AS persistent_local_id,
a.persistent_local_id AS address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public void Configure(EntityTypeBuilder<ActiveAddressOutsideMunicipalityBounds>
public const string ViewName = "view_active_address_outside_municipality_bounds";

public const string Create = $@"
DROP VIEW IF EXISTS {Schema.SuspiciousCases}.{ViewName};
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id as varchar) AS persistent_local_id,
a.persistent_local_id as address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Configure(EntityTypeBuilder<ActiveBuildingUnitLinkedToMultipleAddres
public const string ViewName = "view_building_unit_linked_to_multiple_addresses";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(bu.building_unit_persistent_local_id as varchar) AS persistent_local_id,
bu.building_unit_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<AddressLongerThanTwoYearsProposed> build
public const string ViewName = "view_address_longer_than_two_years_proposed";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id as varchar) AS persistent_local_id,
a.persistent_local_id AS address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<BuildingLongerThanTwoYearsPlanned> build
public const string ViewName = "view_buildings_longer_than_two_years_planned";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(b.building_persistent_local_id as varchar) AS persistent_local_id,
b.building_persistent_local_id AS building_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<BuildingUnitsLongerThanTwoYearsPlanned>
public const string ViewName = "view_building_unit_longer_than_two_years_planned";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(bu.building_unit_persistent_local_id as varchar) AS persistent_local_id,
bu.building_unit_persistent_local_id AS building_unit_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Configure(EntityTypeBuilder<CurrentAddressLinkedWithBuildingUnitButN
public const string ViewName = "view_current_address_linked_with_building_unit_but_not_with_parcel";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id AS varchar) AS persistent_local_id,
a.persistent_local_id AS address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void Configure(EntityTypeBuilder<CurrentAddressWithSpecificationDerivedFr
public const string ViewName = "view_current_address_with_specification_derived_from_building_unit_without_linked_building_unit";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id as varchar) AS persistent_local_id,
a.persistent_local_id AS address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Configure(EntityTypeBuilder<CurrentAddressWithoutLinkedParcelOrBuild
public const string ViewName = "view_current_address_without_linked_parcel_or_building_unit";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id as varchar) AS persistent_local_id,
a.persistent_local_id AS address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<CurrentStreetNameWithoutLinkedRoadSegmen
public const string ViewName = "view_current_street_name_without_linked_road_segments";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(s.persistent_local_id as varchar) AS persistent_local_id,
s.persistent_local_id AS streetname_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<MeasuredRoadSegmentWithNoOrSingleLinkedS
public const string ViewName = "view_measured_road_segment_with_no_or_single_linked_streetname";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(rs.id as varchar) AS persistent_local_id,
rs.id AS road_segment_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Configure(EntityTypeBuilder<ProposedAddressWithoutLinkedParcelOrBuil
public const string ViewName = "view_proposed_address_without_linked_parcel_or_building_unit";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(a.persistent_local_id as varchar) AS persistent_local_id,
a.persistent_local_id AS address_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Configure(EntityTypeBuilder<RoadSegmentLongerThanTwoYearsWithPermit>
public const string ViewName = "view_road_segment_longer_than_two_years_with_permit";

public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(rs.id as varchar) AS persistent_local_id,
rs.id AS road_segment_persistent_local_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void Configure(EntityTypeBuilder<StreetNameLongerThanTwoYearsProposed> bu

// Todo replace schema and table name with constants
public const string Create = $@"
CREATE VIEW {Schema.SuspiciousCases}.{ViewName} AS
CREATE OR REPLACE VIEW {Schema.SuspiciousCases}.{ViewName} AS
SELECT
CAST(streetname.persistent_local_id as varchar) AS persistent_local_id,
streetname.persistent_local_id AS streetname_persistent_local_id,
Expand Down

0 comments on commit 8f19c38

Please sign in to comment.