diff --git a/src/OpenFTTH.GDBIntegrator.GeoDatabase/OpenFTTH.GDBIntegrator.GeoDatabase.csproj b/src/OpenFTTH.GDBIntegrator.GeoDatabase/OpenFTTH.GDBIntegrator.GeoDatabase.csproj index d0123b0..ea4e139 100644 --- a/src/OpenFTTH.GDBIntegrator.GeoDatabase/OpenFTTH.GDBIntegrator.GeoDatabase.csproj +++ b/src/OpenFTTH.GDBIntegrator.GeoDatabase/OpenFTTH.GDBIntegrator.GeoDatabase.csproj @@ -22,6 +22,7 @@ + diff --git a/src/OpenFTTH.GDBIntegrator.GeoDatabase/Postgres/SchemaMigration/1710080321_AddConstraintIsSimpleGeometryRouteNetwork.cs b/src/OpenFTTH.GDBIntegrator.GeoDatabase/Postgres/SchemaMigration/1710080321_AddConstraintIsSimpleGeometryRouteNetwork.cs new file mode 100644 index 0000000..234ccd0 --- /dev/null +++ b/src/OpenFTTH.GDBIntegrator.GeoDatabase/Postgres/SchemaMigration/1710080321_AddConstraintIsSimpleGeometryRouteNetwork.cs @@ -0,0 +1,20 @@ +using FluentMigrator; +using System.IO; + +namespace OpenFTTH.GDBIntegrator.GeoDatabase.Postgres.SchemaMigration +{ + [Migration(1710080321)] + public class AddConstraintIsSimpleGeometryRouteNetwork : Migration + { + public override void Up() + { + Execute.Script(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + + "/Postgres/SchemaMigration/Scripts/set_constraint_is_simple_route_network.sql"); + } + + public override void Down() + { + // This is a hard change to do and needs to be resolved manually if a down is needed to be done. + } + } +} diff --git a/src/OpenFTTH.GDBIntegrator.GeoDatabase/Postgres/SchemaMigration/Scripts/set_constraint_is_simple_route_network.sql b/src/OpenFTTH.GDBIntegrator.GeoDatabase/Postgres/SchemaMigration/Scripts/set_constraint_is_simple_route_network.sql new file mode 100644 index 0000000..b10b860 --- /dev/null +++ b/src/OpenFTTH.GDBIntegrator.GeoDatabase/Postgres/SchemaMigration/Scripts/set_constraint_is_simple_route_network.sql @@ -0,0 +1,2 @@ +ALTER TABLE route_network.route_node ADD CONSTRAINT CHECK_IS_SIMPLE_GEOMETRY CHECK (st_issimple(coord)); +ALTER TABLE route_network.route_segment ADD CONSTRAINT CHECK_IS_SIMPLE_GEOMETRY CHECK (st_issimple(coord));