Skip to content

Commit

Permalink
sets constraint is simple for route network geometry field (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen authored Mar 10, 2024
1 parent d2d10aa commit 4733785
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<None Update="Postgres/SchemaMigration/Scripts/update_and_create_trigger_changes.sql" CopyToOutputDirectory="PreserveNewest" />
<None Update="Postgres/SchemaMigration/Scripts/set_valid_geometry_constraint_route_network.sql" CopyToOutputDirectory="PreserveNewest" />
<None Update="Postgres/SchemaMigration/Scripts/set_not_null_constraint_route_network.sql" CopyToOutputDirectory="PreserveNewest" />
<None Update="Postgres/SchemaMigration/Scripts/set_constraint_is_simple_route_network.sql" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -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.
}
}
}
Original file line number Diff line number Diff line change
@@ -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));

0 comments on commit 4733785

Please sign in to comment.