argos/dmp-db-scema/updates/00.01.025_addStorageFile.sql

32 lines
919 B
SQL

DO $$DECLARE
this_version CONSTANT varchar := '00.01.025';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE public."StorageFile"
(
id uuid NOT NULL,
file_ref character varying(100) NOT NULL,
name character varying(250) NOT NULL,
extension character varying(10) NOT NULL,
mime_type character varying(200) NOT NULL,
storage_type smallint NOT NULL,
created_at timestamp without time zone NOT NULL,
purge_at timestamp without time zone,
purged_at timestamp without time zone,
owner uuid,
PRIMARY KEY (id),
FOREIGN KEY (owner)
REFERENCES public."User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
)
WITH (
OIDS = FALSE
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.025', '2023-11-20 12:00:00.000000+02', now(), 'Add table StorageFile.');
END$$;