create extension postgis;



-- Table: ouvrage.troncon

-- DROP TABLE ouvrage.troncon;

CREATE TABLE public.pipe
(
  id integer NOT NULL, -- Identifiant unique. Lien vers la table ouvrepere
  geometrie geometry(LineString,2154), -- Géométrie de type « LINESTRING » orientée dans le sens d'écoulement
  start_node integer, -- Lien vers la table noeud
  end_node integer, -- Lien vers la table noeud
  numero integer ,
  CONSTRAINT troncon_pkey PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);


Create view public.vw_pipe as

select * from public.pipe;





 INSERT INTO "public"."pipe"("geometrie","id","start_node","end_node","numero") VALUES (st_geomfromwkb('\x01020000000400000027da7726fdd823416f58f5cba42e5a41120d501747d92341d8ee903fa52e5a418f102056a3d923414d266ca5a42e5a41c14963dbd0d923411749ee84a52e5a41'::bytea,2154),'1',NULL,NULL,NULL) ;

INSERT INTO "public"."pipe"("geometrie","id","start_node","end_node","numero") VALUES (st_geomfromwkb('\x0102000000030000000a32149e81d9234157a52d1e942e5a415c4870fee0d92341b287e88e9f2e5a41c14963dbd0d923411749ee84a52e5a41'::bytea,2154),'2',NULL,NULL,NULL) ;


INSERT INTO "public"."pipe"("geometrie","id","start_node","end_node","numero") VALUES (st_geomfromwkb('\x01020000000400000079d2fae132da234103edc3daa92e5a41a34e26f71cda23418bcf933aa82e5a4191d4417beed92341a4843d3ca72e5a41c14963dbd0d923411749ee84a52e5a41'::bytea,2154),'3',NULL,NULL,NULL) ;