Actualizado script de Creación de BBD para unificar la gestión de

permisos al final. Incluidos permisos para usuario de la máquina de PRE.
This commit is contained in:
Marcos Garcia Nuñez
2019-12-17 00:00:03 +01:00
parent e04bbf6f35
commit ea98690703

View File

@@ -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;
$$