-- Create "VClaimSepHist" table
CREATE TABLE "public"."VClaimSepHist" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "RequestPayload" text NULL,
  "ResponseBody" text NULL,
  "Message" text NULL,
  PRIMARY KEY ("Id")
);
-- Modify "Encounter" table
ALTER TABLE "public"."Encounter" ADD COLUMN "PaymentMethod_Code" character varying(10) NULL, ADD COLUMN "InsuranceCompany_Id" bigint NULL, ADD COLUMN "Member_Number" character varying(20) NULL, ADD COLUMN "Ref_Number" character varying(20) NULL, ADD COLUMN "Trx_Number" character varying(20) NULL, ADD COLUMN "Adm_Employee_Id" bigint NULL, ADD CONSTRAINT "uni_Encounter_Member_Number" UNIQUE ("Member_Number"), ADD CONSTRAINT "uni_Encounter_Ref_Number" UNIQUE ("Ref_Number"), ADD CONSTRAINT "uni_Encounter_Trx_Number" UNIQUE ("Trx_Number"), ADD CONSTRAINT "fk_Encounter_Adm_Employee" FOREIGN KEY ("Adm_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Encounter_InsuranceCompany" FOREIGN KEY ("InsuranceCompany_Id") REFERENCES "public"."InsuranceCompany" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
-- Create "VClaimSep" table
CREATE TABLE "public"."VClaimSep" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "Encounter_Id" bigint NULL,
  "Number" character varying(19) NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "uni_VClaimSep_Number" UNIQUE ("Number"),
  CONSTRAINT "fk_Encounter_VclaimSep" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
-- Create "VClaimSepPrint" table
CREATE TABLE "public"."VClaimSepPrint" (
  "Id" bigserial NOT NULL,
  "CreatedAt" timestamptz NULL,
  "UpdatedAt" timestamptz NULL,
  "DeletedAt" timestamptz NULL,
  "VclaimSep_Number" character varying(19) NULL,
  "Counter" bigint NULL,
  PRIMARY KEY ("Id"),
  CONSTRAINT "fk_VClaimSepPrint_VclaimSep" FOREIGN KEY ("VclaimSep_Number") REFERENCES "public"."VClaimSep" ("Number") ON UPDATE NO ACTION ON DELETE NO ACTION
);
