Merge branch 'master' into rorden
# Conflicts: # 2.database/01.CreateTables.sql # 2.database/02.Datos_prueba.sql
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
-- 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,49 +179,56 @@ 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 ),
|
||||
title VARCHAR(512) COLLATE pg_catalog."default" NOT NULL,
|
||||
message TEXT COLLATE pg_catalog."default" NOT NULL,
|
||||
status INTEGER,
|
||||
status VARCHAR(20) NOT NULL,
|
||||
response TEXT COLLATE pg_catalog."default",
|
||||
patientid INTEGER REFERENCES myhealth.patient(id),
|
||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id),
|
||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
||||
familydoctorid INTEGER REFERENCES myhealth.familydoctor(id) NOT NULL,
|
||||
CONSTRAINT question_pkey PRIMARY KEY (id)
|
||||
)
|
||||
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 ),
|
||||
date DATE,
|
||||
"time" TIME,
|
||||
date DATE NOT NULL,
|
||||
"time" TIME NOT NULL,
|
||||
observations TEXT COLLATE pg_catalog."default",
|
||||
highresimage bytea,
|
||||
type INTEGER,
|
||||
patientid INTEGER REFERENCES myhealth.patient(id),
|
||||
specialistdoctorid INTEGER REFERENCES myhealth.specialistdoctor(id),
|
||||
highresimage TEXT,
|
||||
type VARCHAR(30) NOT NULL,
|
||||
patientid INTEGER REFERENCES myhealth.patient(id) NOT NULL,
|
||||
specialistdoctorid INTEGER REFERENCES myhealth.specialistdoctor(id) NOT NULL,
|
||||
CONSTRAINT medicaltest_pkey PRIMARY KEY (id)
|
||||
)
|
||||
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;
|
||||
$$
|
||||
$$
|
||||
Reference in New Issue
Block a user