42 lines
1.5 KiB
MySQL
42 lines
1.5 KiB
MySQL
|
DO $$DECLARE
|
||
|
this_version CONSTANT varchar := '00.01.028';
|
||
|
BEGIN
|
||
|
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||
|
IF FOUND THEN RETURN; END IF;
|
||
|
|
||
|
CREATE TABLE public."Notification"
|
||
|
(
|
||
|
id uuid NOT NULL,
|
||
|
"user" uuid,
|
||
|
tenant uuid,
|
||
|
type uuid,
|
||
|
contact_type_hint character varying(200),
|
||
|
contact_hint character varying(200),
|
||
|
notified_at timestamp without time zone,
|
||
|
created_at timestamp without time zone NOT NULL,
|
||
|
updated_at timestamp without time zone NOT NULL,
|
||
|
is_active character varying(100) NOT NULL,
|
||
|
data text,
|
||
|
notify_state character varying(200),
|
||
|
notified_with character varying(200),
|
||
|
retry_count integer,
|
||
|
tracking_data text,
|
||
|
provenance_ref character varying(200),
|
||
|
tracking_state smallint NOT NULL,
|
||
|
tracking_process smallint NOT NULL,
|
||
|
CONSTRAINT "Notification_pkey" PRIMARY KEY (id),
|
||
|
CONSTRAINT "Notification_tenant_fkey" FOREIGN KEY (tenant)
|
||
|
REFERENCES public."Tenant" (id) MATCH SIMPLE
|
||
|
ON UPDATE NO ACTION
|
||
|
ON DELETE NO ACTION
|
||
|
NOT VALID,
|
||
|
CONSTRAINT "Notification_user_fkey" FOREIGN KEY ("user")
|
||
|
REFERENCES public."User" (id) MATCH SIMPLE
|
||
|
ON UPDATE NO ACTION
|
||
|
ON DELETE NO ACTION
|
||
|
NOT VALID
|
||
|
);
|
||
|
|
||
|
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.028', '2023-12-05 12:00:00.000000+02', now(), 'Add table Notification.');
|
||
|
|
||
|
END$$;
|