Commit 0c79eb9c authored by Alice Salsé's avatar Alice Salsé
Browse files

👌 pipe_id type

parent e1812b0f
......@@ -15,7 +15,7 @@ begin
_pipe_table_name := TG_ARGV[0];
--++++ TOPO UPDATES ++++
IF TG_OP = 'UPDATE'
and new.pipe_id = '0' and old.pipe_id is not null
and new.pipe_id = 0 and old.pipe_id is not null
and not ST_Equals(new.geom, old.geom) THEN -- If UPDATE
--> add vertice to connected pipe geom
EXECUTE FORMAT (
......
......@@ -17,7 +17,7 @@ begin
new.angle:=utils.fnc_point_angle_on_line(new.geom,ST_SetSRID(St_GeomFromGeoJSON(_pipe->>'geom'), 2154)::geometry);
new.pipe_id:=(_pipe->>'id')::int;
elsif TG_OP = 'UPDATE' and _pipe is null and old.pipe_id is not null THEN
new.pipe_id:='0';
new.pipe_id:=0;
--==== DIFFER CONSTRAINTS ====
EXECUTE 'SET CONSTRAINTS '||TG_TABLE_SCHEMA||'.'||TG_TABLE_NAME||'_pipe_id_fkey DEFERRED;';
EXECUTE 'SET CONSTRAINTS '||TG_TABLE_SCHEMA||'.'||TG_TABLE_NAME||'_pipe_id_level_fkey DEFERRED;';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment