-- Modify "DeviceOrder" table
ALTER TABLE "public"."DeviceOrder" DROP CONSTRAINT "fk_DeviceOrder_Doctor", DROP COLUMN "Doctor_Id", ALTER COLUMN "Doctor_Code" TYPE character varying(20), ADD CONSTRAINT "fk_DeviceOrder_Doctor" FOREIGN KEY ("Doctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "Inpatient" table
ALTER TABLE "public"."Inpatient" DROP CONSTRAINT "fk_Inpatient_Infra", DROP COLUMN "Infra_Id", ADD CONSTRAINT "fk_Inpatient_Infra" FOREIGN KEY ("Infra_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "MaterialOrder" table
ALTER TABLE "public"."MaterialOrder" DROP CONSTRAINT "fk_MaterialOrder_Doctor", DROP COLUMN "Doctor_Id", ALTER COLUMN "Doctor_Code" TYPE character varying(20), ADD CONSTRAINT "fk_MaterialOrder_Doctor" FOREIGN KEY ("Doctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "McuOrder" table
ALTER TABLE "public"."McuOrder" DROP CONSTRAINT "fk_McuOrder_Doctor", DROP COLUMN "Doctor_Id", ALTER COLUMN "Doctor_Code" TYPE character varying(20), ADD CONSTRAINT "fk_McuOrder_Doctor" FOREIGN KEY ("Doctor_Code") REFERENCES "public"."Doctor" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
