28 lines
993 B
SQL
28 lines
993 B
SQL
DO $$DECLARE
|
|
this_version CONSTANT varchar := '00.01.053';
|
|
BEGIN
|
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
|
IF FOUND THEN RETURN; END IF;
|
|
|
|
CREATE TABLE IF NOT EXISTS public."ant_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 "ant_TenantUser_pkey" PRIMARY KEY (id),
|
|
CONSTRAINT "ant_TenantUser_tenant_fkey" FOREIGN KEY ("tenant")
|
|
REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION,
|
|
CONSTRAINT "ant_TenantUser_user_fkey" FOREIGN KEY ("user")
|
|
REFERENCES public."ant_User" (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE NO ACTION
|
|
)
|
|
|
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.053', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_TenantUser.');
|
|
|
|
END$$; |