Add in DB table UploadFile

This commit is contained in:
Konstantina Galouni 2022-03-16 11:32:06 +02:00
parent dc06ba9201
commit 744160c84a
2 changed files with 49 additions and 0 deletions

View File

@ -904,6 +904,28 @@ CREATE TABLE public."UserToken" (
ALTER TABLE public."UserToken" OWNER TO :POSTGRES_USER; ALTER TABLE public."UserToken" OWNER TO :POSTGRES_USER;
--
-- Name: FileUpload; Type: TABLE; Schema: public; Owner: :POSTGRES_USER
--
CREATE TYPE EntityType AS ENUM ('DATASET', 'DMP');
CREATE TABLE public."FileUpload"
(
"ID" uuid NOT NULL,
"Name" character varying(250) NOT NULL,
"FileType" character varying(50) NOt NULL,
"EntityId" uuid NOT NULL,
"EntityType" EntityType NOT NULL,
"CreatedAt" timestamp(6) with time zone DEFAULT now() NOT NULL,
"IsDeleted" boolean DEFAULT false NOT NULL,
"Creator" uuid NOT NULL,
CONSTRAINT "File_pkey" PRIMARY KEY ("ID"),
CONSTRAINT fk_fileupload_creator FOREIGN KEY ("Creator") REFERENCES public."UserInfo"(id)
);
ALTER TABLE public."FileUpload" OWNER TO :POSTGRES_USER;
-- --
-- Name: Content Content_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- Name: Content Content_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER
-- --

View File

@ -0,0 +1,27 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.00.009';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TYPE EntityType AS ENUM ('DATASET', 'DMP');
CREATE TABLE public."FileUpload"
(
"ID" uuid NOT NULL,
"Name" character varying(250) NOT NULL,
"FileType" character varying(50) NOt NULL,
"EntityId" uuid NOT NULL,
"EntityType" EntityType NOT NULL,
"CreatedAt" timestamp(6) with time zone DEFAULT now() NOT NULL,
"IsDeleted" boolean DEFAULT false NOT NULL,
"Creator" uuid NOT NULL,
CONSTRAINT "File_pkey" PRIMARY KEY ("ID"),
CONSTRAINT fk_fileupload_creator FOREIGN KEY ("Creator") REFERENCES public."UserInfo"(id)
);
/*ALTER TABLE public."UploadFile" OWNER TO :POSTGRES_USER;*/
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.009', '2022-03-03 15:50:00.000000+02', now(), 'Add File Table for uploaded files');
END$$;