-- Create "Counter" table CREATE TABLE "public"."Counter" ( "Id" serial NOT NULL, "CreatedAt" timestamptz NULL, "UpdatedAt" timestamptz NULL, "DeletedAt" timestamptz NULL, "Code" character varying(10) NULL, "Name" character varying(30) NULL, "Number" smallint NULL, "Parent_Id" integer NULL, "Type_Code" text NULL, "Queue_Code" character varying(5) NULL, PRIMARY KEY ("Id"), CONSTRAINT "uni_Counter_Code" UNIQUE ("Code") ); -- Create "Doctor" table CREATE TABLE "public"."Doctor" ( "Id" bigserial NOT NULL, "CreatedAt" timestamptz NULL, "UpdatedAt" timestamptz NULL, "DeletedAt" timestamptz NULL, "Employee_Id" bigint NULL, "IHS_Number" character varying(20) NULL, "SIP_Number" character varying(20) NULL, "Unit_Id" bigint NULL, PRIMARY KEY ("Id"), CONSTRAINT "fk_Doctor_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT "fk_Doctor_Unit" FOREIGN KEY ("Unit_Id") REFERENCES "public"."Unit" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION ); -- Create "Nurse" table CREATE TABLE "public"."Nurse" ( "Id" bigserial NOT NULL, "CreatedAt" timestamptz NULL, "UpdatedAt" timestamptz NULL, "DeletedAt" timestamptz NULL, "Employee_Id" bigint NULL, "IHS_Number" character varying(20) NULL, PRIMARY KEY ("Id"), CONSTRAINT "fk_Nurse_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION ); -- Create "Nutritionist" table CREATE TABLE "public"."Nutritionist" ( "Id" bigserial NOT NULL, "CreatedAt" timestamptz NULL, "UpdatedAt" timestamptz NULL, "DeletedAt" timestamptz NULL, "Employee_Id" bigint NULL, "IHS_Number" character varying(20) NULL, PRIMARY KEY ("Id"), CONSTRAINT "fk_Nutritionist_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION ); -- Create "Pharmacist" table CREATE TABLE "public"."Pharmacist" ( "Id" bigserial NOT NULL, "CreatedAt" timestamptz NULL, "UpdatedAt" timestamptz NULL, "DeletedAt" timestamptz NULL, "Employee_Id" bigint NULL, "IHS_Number" character varying(20) NULL, PRIMARY KEY ("Id"), CONSTRAINT "fk_Pharmacist_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION ); -- Create "PracticeSchedule" table CREATE TABLE "public"."PracticeSchedule" ( "Id" bigserial NOT NULL, "CreatedAt" timestamptz NULL, "UpdatedAt" timestamptz NULL, "DeletedAt" timestamptz NULL, "Doctor_Id" bigint NULL, "Unit_Code" character varying(10) NULL, "Day_Code" smallint NULL, "StartTime" character varying(5) NULL, "EndTime" character varying(5) NULL, PRIMARY KEY ("Id"), CONSTRAINT "fk_PracticeSchedule_Doctor" FOREIGN KEY ("Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT "fk_PracticeSchedule_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION );