-- Modify "Prescription" table
ALTER TABLE "public"."Prescription" ADD COLUMN "Doctor_Code" character varying(20) NULL;
-- Modify "Doctor" table
ALTER TABLE "public"."Doctor" DROP CONSTRAINT "fk_Doctor_Specialist", DROP CONSTRAINT "fk_Doctor_Subspecialist", DROP CONSTRAINT "fk_Doctor_Unit", DROP COLUMN "Unit_Id", DROP COLUMN "Specialist_Id", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_Doctor_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Doctor_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Doctor_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "Nurse" table
ALTER TABLE "public"."Nurse" DROP CONSTRAINT "fk_Nurse_Infra", DROP CONSTRAINT "fk_Nurse_Unit", DROP COLUMN "Unit_Id", DROP COLUMN "Infra_Id", ADD CONSTRAINT "fk_Nurse_Infra" FOREIGN KEY ("Infra_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Nurse_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Modify "SpecialistIntern" table
ALTER TABLE "public"."SpecialistIntern" DROP CONSTRAINT "fk_SpecialistIntern_Specialist", DROP CONSTRAINT "fk_SpecialistIntern_Subspecialist", DROP COLUMN "Specialist_Id", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_SpecialistIntern_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_SpecialistIntern_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
