-- Table: public.Schaechte

-- DROP TABLE IF EXISTS public."Schaechte";

CREATE TABLE IF NOT EXISTS public."Schaechte"
(
    "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",
    "RechtsWert" numeric(18,4) NOT NULL,
    "HochWert" numeric(18,4) NOT NULL,
    "SohlHoehe" numeric(18,4) NOT NULL,
    "DeckelHoehe" numeric(18,4) NOT NULL,
    "Entwaesserung" integer NOT NULL,
    "ProjektId" integer,
    CONSTRAINT "PK_Schaechte" PRIMARY KEY ("Id"),
    CONSTRAINT "FK_Schaechte_Projekte_ProjektId" FOREIGN KEY ("ProjektId")
        REFERENCES public."Projekte" ("Id") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public."Schaechte"
    OWNER to "SewerGen";
-- Index: IX_Schaechte_ProjektId

-- DROP INDEX IF EXISTS public."IX_Schaechte_ProjektId";

CREATE INDEX IF NOT EXISTS "IX_Schaechte_ProjektId"
    ON public."Schaechte" USING btree
    ("ProjektId" ASC NULLS LAST)
    TABLESPACE pg_default;