-- Tables

-- Alters

ALTER TABLE AKUZ.T_MOVEMENTS_DIVISION_CARD ADD "patientdivisionlocation" uuid NULL;

UPDATE AKUZ.T_MOVEMENTS_DIVISION_CARD SET "patientdivisionlocation" = "division";

ALTER TABLE AKUZ.T_MOVEMENTS_DIVISION_CARD ALTER COLUMN "patientdivisionlocation" SET NOT NULL;

ALTER TABLE AKUZ.T_MOVEMENTS_DIVISION_CARD ADD CONSTRAINT FK_T_DIVISION_T_MOVEMENTS_DIVISION_CARD_PatientDivisionLocation
FOREIGN KEY("patientdivisionlocation") REFERENCES AKUZ.T_DIVISION (DivisionID);

