argos/dmp-db-scema/updates/00.01.067_Add_UsageLimits.sql

27 lines
805 B
MySQL
Raw Normal View History

2024-07-11 17:23:22 +02:00
DO $$DECLARE
this_version CONSTANT varchar := '00.01.067';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
2024-07-12 11:09:40 +02:00
CREATE TABLE public."UsageLimit"
2024-07-11 17:23:22 +02:00
(
id uuid NOT NULL,
label character varying NOT NULL,
target_metric character varying NOT NULL,
value integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
is_active smallint NOT NULL,
tenant uuid,
PRIMARY KEY (id),
2024-07-12 11:09:40 +02:00
CONSTRAINT "UsageLimit_tenant_fkey" FOREIGN KEY (tenant)
2024-07-11 17:23:22 +02:00
REFERENCES public."Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
);
2024-07-12 11:09:40 +02:00
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.067', '2024-11-07 12:00:00.000000+02', now(), 'Add UsageLimit table.');
2024-07-11 17:23:22 +02:00
END$$;