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

32 lines
919 B
MySQL
Raw Permalink Normal View History

2023-11-28 14:05:58 +01:00
DO $$DECLARE
2023-11-29 14:31:51 +01:00
this_version CONSTANT varchar := '00.01.025';
2023-11-28 14:05:58 +01:00
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
);
2023-11-29 14:31:51 +01:00
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.025', '2023-11-20 12:00:00.000000+02', now(), 'Add table StorageFile.');
2023-11-28 14:05:58 +01:00
END$$;