Skip to content

Commit

Permalink
feat: switch wms/wfs views V3 GAWR-6685
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Nov 28, 2024
1 parent e7868e9 commit b7af91e
Show file tree
Hide file tree
Showing 4 changed files with 564 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BuildingRegistry.Projections.Wfs.Migrations
{
using Infrastructure;

/// <inheritdoc />
public partial class SwitchWmsViewsToV3 : Migration
{
private const string BuildingViewName = "GebouwView";

/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql($@"DROP VIEW [{Schema.Wfs}].[{BuildingViewName}]");

migrationBuilder.Sql($@"
CREATE VIEW [{Schema.Wfs}].[{BuildingViewName}]
WITH SCHEMABINDING
AS
SELECT
[PersistentLocalId] AS [MyId],
[Id],
[PersistentLocalId] AS [ObjectId],
[VersionAsString] AS [VersieId],
[Geometry] AS [Geometrie],
[GeometryMethod] AS [GeometrieMethode],
[Status] AS [GebouwStatus]
FROM [{Schema.Wfs}].[{BuildingV3.BuildingConfiguration.TableName}]
WHERE [IsRemoved] = 0 and Geometry is not null");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql($@"DROP VIEW [{Schema.Wfs}].[{BuildingViewName}]");

migrationBuilder.Sql($@"
CREATE VIEW [{Schema.Wfs}].[{BuildingViewName}]
WITH SCHEMABINDING
AS
SELECT
[PersistentLocalId] AS [MyId],
[Id],
[PersistentLocalId] AS [ObjectId],
[VersionAsString] AS [VersieId],
[Geometry] AS [Geometrie],
[GeometryMethod] AS [GeometrieMethode],
[Status] AS [GebouwStatus]
FROM [{Schema.Wfs}].[{BuildingV2.BuildingConfiguration.TableName}]
WHERE [IsRemoved] = 0 and Geometry is not null");
}
}
}
Loading

0 comments on commit b7af91e

Please sign in to comment.