2023-12-05 15:57:06 +01:00
|
|
|
DO $$DECLARE
|
2024-04-04 17:27:18 +02:00
|
|
|
this_version CONSTANT varchar := '00.01.030';
|
2023-12-05 15:57:06 +01:00
|
|
|
BEGIN
|
|
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
|
2024-02-13 17:31:01 +01:00
|
|
|
CREATE TABLE public."ntf_Tenant"
|
|
|
|
(
|
|
|
|
id uuid NOT NULL,
|
|
|
|
code character varying(200) COLLATE pg_catalog."default" NOT NULL,
|
|
|
|
created_at timestamp without time zone NOT NULL DEFAULT now(),
|
|
|
|
updated_at timestamp without time zone NOT NULL DEFAULT now(),
|
|
|
|
is_active smallint NOT NULL DEFAULT 1,
|
|
|
|
CONSTRAINT "ntf_Tenant_pkey" PRIMARY KEY (id)
|
|
|
|
);
|
|
|
|
|
2023-12-06 10:34:24 +01:00
|
|
|
CREATE TABLE public."ntf_TenantConfiguration"
|
2023-12-05 15:57:06 +01:00
|
|
|
(
|
|
|
|
id uuid NOT NULL,
|
2024-04-25 16:59:36 +02:00
|
|
|
tenant uuid NULL,
|
2023-12-05 15:57:06 +01:00
|
|
|
type smallint NOT NULL,
|
2023-12-06 10:34:24 +01:00
|
|
|
value character varying COLLATE pg_catalog."default" NOT NULL,
|
2023-12-05 15:57:06 +01:00
|
|
|
is_active smallint NOT NULL,
|
|
|
|
created_at timestamp without time zone NOT NULL,
|
|
|
|
updated_at timestamp without time zone NOT NULL,
|
2023-12-06 10:34:24 +01:00
|
|
|
CONSTRAINT "ntf_TenantConfguration_pkey" PRIMARY KEY (id),
|
|
|
|
CONSTRAINT "ntf_TenantConfiguration_tenant_fkey" FOREIGN KEY (tenant)
|
2024-02-13 17:31:01 +01:00
|
|
|
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
|
2023-12-05 15:57:06 +01:00
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
);
|
|
|
|
|
2024-04-04 17:27:18 +02:00
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.030', '2023-12-05 12:00:00.000000+02', now(), 'Add tables ntf_Tenant and ntf_TenantConfiguration.');
|
2023-12-05 15:57:06 +01:00
|
|
|
|
|
|
|
END$$;
|