2024-01-25 11:28:21 +01:00
|
|
|
DO $$DECLARE
|
|
|
|
this_version CONSTANT varchar := '00.01.046';
|
|
|
|
BEGIN
|
|
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS public."ntf_TenantUser"
|
|
|
|
(
|
|
|
|
"id" uuid NOT NULL,
|
|
|
|
"user" uuid NOT NULL,
|
|
|
|
"tenant" uuid NOT NULL,
|
|
|
|
"is_active" smallint NOT NULL,
|
|
|
|
"created_at" timestamp without time zone NOT NULL,
|
|
|
|
"updated_at" timestamp without time zone NOT NULL,
|
|
|
|
CONSTRAINT "ntf_TenantUser_pkey" PRIMARY KEY (id),
|
|
|
|
CONSTRAINT "ntf_TenantUser_tenant_fkey" FOREIGN KEY ("tenant")
|
|
|
|
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION,
|
|
|
|
CONSTRAINT "ntf_TenantUser_user_fkey" FOREIGN KEY ("user")
|
|
|
|
REFERENCES public."ntf_User" (id) MATCH SIMPLE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
2024-02-15 17:36:46 +01:00
|
|
|
);
|
2024-01-25 11:28:21 +01:00
|
|
|
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.046', '2024-01-25 12:00:00.000000+02', now(), 'Add table ntf_TenantUser.');
|
|
|
|
|
|
|
|
END$$;
|