-- Modify "Medication" table
ALTER TABLE "public"."Medication" DROP CONSTRAINT "fk_Medication_Pharmacist", DROP COLUMN "Pharmacist_Id", ALTER COLUMN "Pharmacist_Code" TYPE character varying(20), ADD CONSTRAINT "fk_Medication_Pharmacist" FOREIGN KEY ("Pharmacist_Code") REFERENCES "public"."Pharmacist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "MedicationItem" table
ALTER TABLE "public"."MedicationItem" DROP CONSTRAINT "fk_MedicationItem_Medicine", DROP COLUMN "Medicine_Id", ALTER COLUMN "Medicine_Code" TYPE character varying(10), ADD CONSTRAINT "fk_MedicationItem_Medicine" FOREIGN KEY ("Medicine_Code") REFERENCES "public"."Medicine" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "MedicationItemDist" table
ALTER TABLE "public"."MedicationItemDist" DROP CONSTRAINT "fk_MedicationItemDist_Nurse", DROP COLUMN "Nurse_Id", ALTER COLUMN "Nurse_Code" TYPE character varying(20), ADD CONSTRAINT "fk_MedicationItemDist_Nurse" FOREIGN KEY ("Nurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "MedicineMixItem" table
ALTER TABLE "public"."MedicineMixItem" DROP CONSTRAINT "fk_MedicineMixItem_Medicine", DROP COLUMN "Medicine_Id", ALTER COLUMN "Medicine_Code" TYPE character varying(10), ADD CONSTRAINT "fk_MedicineMixItem_Medicine" FOREIGN KEY ("Medicine_Code") REFERENCES "public"."Medicine" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "PrescriptionItem" table
ALTER TABLE "public"."PrescriptionItem" DROP CONSTRAINT "fk_PrescriptionItem_Medicine", DROP COLUMN "Medicine_Id", ALTER COLUMN "Medicine_Code" TYPE character varying(10), ADD CONSTRAINT "fk_PrescriptionItem_Medicine" FOREIGN KEY ("Medicine_Code") REFERENCES "public"."Medicine" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
