argos/dmp-db-scema/updates/00.01.029_addQueueOutbox.sql

31 lines
1.1 KiB
SQL

DO $$DECLARE
this_version CONSTANT varchar := '00.01.029';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE public."QueueOutbox"
(
id uuid NOT NULL,
exchange character varying(200) NOT NULL,
route character varying(200) NOT NULL,
message_id uuid NOT NULL,
notify_status character varying(100) NOT NULL,
retry_count integer NOT NULL,
published_at timestamp without time zone,
confirmed_at timestamp without time zone,
tenant uuid,
is_active timestamp without time zone NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
CONSTRAINT "QueueOutbox_pkey" PRIMARY KEY (id),
CONSTRAINT "QueueOutbox_tennat_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.029', '2023-12-05 12:00:00.000000+02', now(), 'Add table QueueOutbox.');
END$$;