argos/dmp-db-scema/updates/00.01.044_Add_ntf_User_Cont...

32 lines
1.2 KiB
SQL

DO $$DECLARE
this_version CONSTANT varchar := '00.01.044';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE IF NOT EXISTS public."ntf_UserContactInfo"
(
"id" uuid NOT NULL,
"user" uuid NOT NULL,
"ordinal" integer NOT NULL DEFAULT 0,
"type" smallint NOT NULL,
"value" character varying(512) COLLATE pg_catalog."default" NOT NULL,
"created_at" timestamp without time zone NOT NULL,
"updated_at" timestamp without time zone NOT NULL,
"is_active" smallint NOT NULL DEFAULT 1,
"tenant" uuid,
CONSTRAINT "ntf_UserContactInfo_pkey" PRIMARY KEY (id),
CONSTRAINT "ntf_UserContactInfo_tenant_fkey" FOREIGN KEY ("tenant")
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "ntf_UserContactInfo_user_fkey" FOREIGN KEY ("user")
REFERENCES public."ntf_User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.044', '2024-01-24 12:00:00.000000+02', now(), 'Add table ntf_UserContactInfo.');
END$$;