-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
234 additions
and
4 deletions.
There are no files selected for viewing
182 changes: 182 additions & 0 deletions
182
...reetNameRegistry.Projections.Wfs/Migrations/20241023072631_AddGeolocationView.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
src/StreetNameRegistry.Projections.Wfs/Migrations/20241023072631_AddGeolocationView.cs
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,50 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace StreetNameRegistry.Projections.Wfs.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class AddGeolocationView : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.EnsureSchema(name: "geolocation"); | ||
migrationBuilder.Sql("ALTER AUTHORIZATION ON SCHEMA::geolocation TO wms"); | ||
migrationBuilder.Sql(@" | ||
CREATE VIEW geolocation.StreetNameOsloGeolocationView WITH SCHEMABINDING AS | ||
SELECT | ||
CASE WHEN Removed = 1 THEN NULL ELSE CONCAT('https://data.vlaanderen.be/id/straatnaam/', [PersistentLocalId]) END as IDENTIFICATOR_ID | ||
,CASE WHEN Removed = 1 THEN NULL ELSE 'https://data.vlaanderen.be/id/straatnaam' END as IDENTIFICATOR_NAAMRUIMTE | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [PersistentLocalId] END as IDENTIFICATOR_OBJECTID | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [VersionAsString] END as IDENTIFICATOR_VERSIEID | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [NisCode] END as GEMEENTE_OBJECTID | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [NameDutch] END as STRAATNAAM_NL | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [NameFrench] END as STRAATNAAM_FR | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [NameGerman] END as STRAATNAAM_DE | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [HomonymAdditionDutch] END as HOMONIEMTOEVOEGING_NL | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [HomonymAdditionFrench] END as HOMONIEMTOEVOEGING_FR | ||
,CASE WHEN Removed = 1 THEN NULL ELSE [HomonymAdditionGerman] END as HOMONIEMTOEVOEGING_DE | ||
,CASE WHEN Removed = 1 THEN NULL ELSE | ||
CASE | ||
WHEN [Status] = 0 THEN 'voorgesteld' | ||
WHEN [Status] = 1 THEN 'inGebruik' | ||
WHEN [Status] = 2 THEN 'gehistoreerd' | ||
WHEN [Status] = 3 THEN 'afgekeurd' | ||
END | ||
END as STRAATNAAMSTATUS | ||
,[Removed] as REMOVED | ||
,[PersistentLocalId] as [msgkey] | ||
FROM [wfs.streetname].[StreetNameHelperV2]"); | ||
|
||
migrationBuilder.Sql("CREATE UNIQUE CLUSTERED INDEX IX_StreetNameGeolocationView_ObjectId ON [geolocation].[StreetNameOsloGeolocationView] ([msgkey])"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.Sql("DROP VIEW geolocation.StreetNameOsloGeolocationView;"); | ||
} | ||
} | ||
} |
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