From 91103ee8efa05d16cc4793b42c00754c4803a000 Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 11 Jul 2024 18:23:22 +0300 Subject: [PATCH] add UsageLimits sql script --- .../updates/00.01.067_Add_UsageLimits.sql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 dmp-db-scema/updates/00.01.067_Add_UsageLimits.sql diff --git a/dmp-db-scema/updates/00.01.067_Add_UsageLimits.sql b/dmp-db-scema/updates/00.01.067_Add_UsageLimits.sql new file mode 100644 index 000000000..9295c435e --- /dev/null +++ b/dmp-db-scema/updates/00.01.067_Add_UsageLimits.sql @@ -0,0 +1,27 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.067'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + CREATE TABLE public."UsageLimits" + ( + 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), + CONSTRAINT "UsageLimits_tenant_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.067', '2024-11-07 12:00:00.000000+02', now(), 'Add UsageLimits table.'); + +END$$; \ No newline at end of file