From ea986907034d6bb906b0b62db9d78063e02a4f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Tue, 17 Dec 2019 00:00:03 +0100 Subject: [PATCH] =?UTF-8?q?Actualizado=20script=20de=20Creaci=C3=B3n=20de?= =?UTF-8?q?=20BBD=20para=20unificar=20la=20gesti=C3=B3n=20de=20permisos=20?= =?UTF-8?q?al=20final.=20Incluidos=20permisos=20para=20usuario=20de=20la?= =?UTF-8?q?=20m=C3=A1quina=20de=20PRE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.database/01.CreateTables.sql | 74 ++++++++++------------------------ 1 file changed, 22 insertions(+), 52 deletions(-) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index a660cf0..31cffc8 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -83,7 +83,6 @@ CREATE SEQUENCE myhealth.CodigoIdentificacionPaciente CACHE 1; -- Table: myhealth.administrator --- DROP TABLE myhealth.administrator; CREATE TABLE myhealth.administrator ( email VARCHAR(120) COLLATE pg_catalog."default" NOT NULL, @@ -92,13 +91,7 @@ CREATE TABLE myhealth.administrator ) TABLESPACE pg_default; -ALTER TABLE myhealth.administrator - OWNER to "USER"; - -- Table: myhealth.primaryhealthcarecenter - --- DROP TABLE myhealth.primaryhealthcarecenter; - CREATE TABLE myhealth.primaryhealthcarecenter ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -108,13 +101,7 @@ CREATE TABLE myhealth.primaryhealthcarecenter ) TABLESPACE pg_default; -ALTER TABLE myhealth.primaryhealthcarecenter - OWNER to "USER"; - -- Table: myhealth.familydoctor - --- DROP TABLE myhealth.familydoctor; - CREATE TABLE myhealth.familydoctor ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -132,13 +119,7 @@ TABLESPACE pg_default; CREATE UNIQUE INDEX family_doctor_professionaln_index ON myhealth.familydoctor (professionalnumber); -ALTER TABLE myhealth.familydoctor - OWNER to "USER"; - -- Table: myhealth.medicalspecialty - --- DROP TABLE myhealth.medicalspecialty; - CREATE TABLE myhealth.medicalspecialty ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -147,14 +128,8 @@ CREATE TABLE myhealth.medicalspecialty CONSTRAINT medicalspecialty_pkey PRIMARY KEY (id) ) TABLESPACE pg_default; - -ALTER TABLE myhealth.medicalspecialty - OWNER to "USER"; - + -- Table: myhealth.patient - --- DROP TABLE myhealth.patient; - CREATE TABLE myhealth.patient ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -172,13 +147,7 @@ TABLESPACE pg_default; CREATE UNIQUE INDEX patient_pic_index ON myhealth.patient (personalIdentificationCode); -ALTER TABLE myhealth.patient - OWNER to "USER"; - -- Table: myhealth.specialistdoctor - --- DROP TABLE myhealth.specialistdoctor; - CREATE TABLE myhealth.specialistdoctor ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -196,13 +165,7 @@ TABLESPACE pg_default; CREATE UNIQUE INDEX specialistdoctor_professionaln_index ON myhealth.specialistdoctor (professionalnumber); -ALTER TABLE myhealth.specialistdoctor - OWNER to "USER"; - -- Table: myhealth.visit - --- DROP TABLE myhealth.visit; - CREATE TABLE myhealth.visit ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -216,13 +179,7 @@ CREATE TABLE myhealth.visit ) TABLESPACE pg_default; -ALTER TABLE myhealth.visit - OWNER to "USER"; - -- Table: myhealth.question - --- DROP TABLE myhealth.question; - CREATE TABLE myhealth.question ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -236,13 +193,7 @@ CREATE TABLE myhealth.question ) TABLESPACE pg_default; -ALTER TABLE myhealth.question - OWNER to "USER"; - -- Table: myhealth.medicaltest - --- DROP TABLE myhealth.medicaltest; - CREATE TABLE myhealth.medicaltest ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), @@ -257,8 +208,27 @@ CREATE TABLE myhealth.medicaltest ) TABLESPACE pg_default; -ALTER TABLE myhealth.medicaltest - OWNER to "USER"; +-- Permisos +ALTER TABLE myhealth.administrator OWNER to "USER"; +ALTER TABLE myhealth.primaryhealthcarecenter OWNER to "USER"; +ALTER TABLE myhealth.familydoctor OWNER to "USER"; +ALTER TABLE myhealth.medicalspecialty OWNER to "USER"; +ALTER TABLE myhealth.patient OWNER to "USER"; +ALTER TABLE myhealth.specialistdoctor OWNER to "USER"; +ALTER TABLE myhealth.visit OWNER to "USER"; +ALTER TABLE myhealth.question OWNER to "USER"; +ALTER TABLE myhealth.medicaltest OWNER to "USER"; + +-- Permisos para la máquina de PRE (usuario: usrmyhealth) +GRANT ALL ON myhealth.administrator to usrmyhealth; +GRANT ALL ON myhealth.primaryhealthcarecenter to usrmyhealth; +GRANT ALL ON myhealth.familydoctor to usrmyhealth; +GRANT ALL ON myhealth.medicalspecialty to usrmyhealth; +GRANT ALL ON myhealth.patient to usrmyhealth; +GRANT ALL ON myhealth.specialistdoctor to usrmyhealth; +GRANT ALL ON myhealth.visit to usrmyhealth; +GRANT ALL ON myhealth.question to usrmyhealth; +GRANT ALL ON myhealth.medicaltest to usrmyhealth; END; $$