Files
SewerGenerator/SQL/haltung.sql
2023-04-18 22:06:00 +02:00

58 lines
2.0 KiB
SQL

-- Table: public.haltung
-- DROP TABLE IF EXISTS public.haltung;
CREATE TABLE IF NOT EXISTS public.haltung
(
haltung_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
objektbezeichnung text COLLATE pg_catalog."default",
ref_startschacht_id integer,
ref_endschacht_id integer,
dn integer NOT NULL,
material text COLLATE pg_catalog."default",
haltungslaenge numeric NOT NULL,
entwaesserung integer NOT NULL,
ref_projekt_id integer,
CONSTRAINT "PK_Kanaele" PRIMARY KEY (haltung_id),
CONSTRAINT "FK_Kanaele_Projekte_ProjektId" FOREIGN KEY (ref_projekt_id)
REFERENCES public.projekt (projekt_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT "FK_Kanaele_Schaechte_EndSchachtId" FOREIGN KEY (ref_endschacht_id)
REFERENCES public.schacht (schacht_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT "FK_Kanaele_Schaechte_StartSchachtId" FOREIGN KEY (ref_startschacht_id)
REFERENCES public.schacht (schacht_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.haltung
OWNER to "SewerGen";
-- Index: IX_Kanaele_EndSchachtId
-- DROP INDEX IF EXISTS public."IX_Kanaele_EndSchachtId";
CREATE INDEX IF NOT EXISTS "IX_Kanaele_EndSchachtId"
ON public.haltung USING btree
(ref_endschacht_id ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: IX_Kanaele_ProjektId
-- DROP INDEX IF EXISTS public."IX_Kanaele_ProjektId";
CREATE INDEX IF NOT EXISTS "IX_Kanaele_ProjektId"
ON public.haltung USING btree
(ref_projekt_id ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: IX_Kanaele_StartSchachtId
-- DROP INDEX IF EXISTS public."IX_Kanaele_StartSchachtId";
CREATE INDEX IF NOT EXISTS "IX_Kanaele_StartSchachtId"
ON public.haltung USING btree
(ref_startschacht_id ASC NULLS LAST)
TABLESPACE pg_default;