create sequence "Tpa_TpaId_seq";

-----------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS public."Tpa"
(
    "TpaId" integer NOT NULL DEFAULT nextval('"Tpa_TpaId_seq"'::regclass),
    "Name" Character Varying(150) unique,
    "Active" boolean DEFAULT true,
    "CreatedBy" integer,
    "CreatedDate" timestamp without time zone,
    "ModifiedBy" integer,
    "ModifiedDate" timestamp without time zone,
    CONSTRAINT "Tpa_pkey" PRIMARY KEY ("TpaId"),
    CONSTRAINT "Tpa_CreatedBy_fkey" FOREIGN KEY ("CreatedBy")
        REFERENCES public."Account" ("AccountId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "Tpa_ModifiedBy_fkey" FOREIGN KEY ("ModifiedBy")
        REFERENCES public."Account" ("AccountId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
);

----------------------------------

 
 alter table "Admission"
add column "TpaId" integer,
add column "PatientOrganization" character varying(150),
add CONSTRAINT "Admission_TpaId_fkey" FOREIGN KEY ("TpaId")
        REFERENCES public."Tpa" ("TpaId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION;
    
    
    
    