-- Tables

-- Alters

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ADD "mes" uuid NULL;

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ADD "mes2" uuid NULL;

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ADD "mes_rec_id" integer NULL;

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ADD "onkosuspicion" boolean NULL;

UPDATE AKUZ.T_MEDICAL_EPISODE SET "onkosuspicion" = '0';

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ALTER COLUMN "onkosuspicion" SET NOT NULL;

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ADD CONSTRAINT FK_T_MES_T_MEDICAL_EPISODE_Mes
FOREIGN KEY("mes") REFERENCES AKUZ.T_MES (MesID);

ALTER TABLE AKUZ.T_MEDICAL_EPISODE ADD CONSTRAINT FK_T_MES_T_MEDICAL_EPISODE_Mes2
FOREIGN KEY("mes2") REFERENCES AKUZ.T_MES (MesID);




ALTER TABLE AKUZ.T_ONK_TREATMENT_CASE ADD "medicalepisode" uuid NULL;

ALTER TABLE AKUZ.T_ONK_TREATMENT_CASE ADD CONSTRAINT FK_T_MEDICAL_EPISODE_T_ONK_TREATMENT_CASE_MedicalEpisode
FOREIGN KEY("medicalepisode") REFERENCES AKUZ.T_MEDICAL_EPISODE (MedicalEpisodeID);





ALTER TABLE AKUZ.T_MOVEMENT_RESULT_LEK_PREP_LINK ADD "medicalepisode" uuid NULL;

ALTER TABLE AKUZ.T_MOVEMENT_RESULT_LEK_PREP_LINK ADD CONSTRAINT FK_T_MEDICAL_EPISODE_T_MOVEMENT_RESULT_LEK_PREP_LINK_M_180A66AA
FOREIGN KEY("medicalepisode") REFERENCES AKUZ.T_MEDICAL_EPISODE (MedicalEpisodeID);

ALTER TABLE AKUZ.T_MOVEMENT_RESULT_LEK_PREP_LINK ALTER COLUMN "outcomeofinspection" DROP NOT NULL;