-- SEQUENCE: public.ProviderAvailabilityVisitType_ProviderAvailabilityVisitTypeId_seq

-- DROP SEQUENCE IF EXISTS public."ProviderAvailabilityVisitType_ProviderAvailabilityVisitTypeId_seq";

CREATE SEQUENCE IF NOT EXISTS public."ProviderAvailabilityVisitType_ProviderAvailabilityVisitTypeId_seq"
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 9223372036854775807
    CACHE 1;

ALTER SEQUENCE public."ProviderAvailabilityVisitType_ProviderAvailabilityVisitTypeId_seq"
    OWNER TO postgres;

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

-- Table: public.ProviderAvailabilityVisitType

-- DROP TABLE IF EXISTS public."ProviderAvailabilityVisitType";

CREATE TABLE IF NOT EXISTS public."ProviderAvailabilityVisitType"
(
    "ProviderAvailabilityVisitTypeId" integer NOT NULL DEFAULT nextval('"ProviderAvailabilityVisitType_ProviderAvailabilityVisitTypeId_s"'::regclass),
    "ProviderAvailabilityId" integer NOT NULL,
    "VisitTypeId" integer NOT NULL,
    "Duration" integer,
    "Active" boolean NOT NULL DEFAULT true,
    "CreatedBy" integer NOT NULL,
    "CreatedDate" timestamp(6) without time zone NOT NULL,
    "ModifiedBy" integer,
    "ModifiedDate" timestamp(6) without time zone,
    CONSTRAINT "ProviderAvailabilityVisitType_pkey" PRIMARY KEY ("ProviderAvailabilityVisitTypeId"),
    CONSTRAINT "FK_ProviderAvailabilityVisitType_ProviderAvailabilityId" FOREIGN KEY ("ProviderAvailabilityId")
        REFERENCES public."ProviderAvailability" ("ProviderAvailabilityId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE CASCADE,
    CONSTRAINT "ProviderAvailabilityVisitType_VisitTypeId_fkey" FOREIGN KEY ("VisitTypeId")
        REFERENCES public."VisitType" ("VisitTypeId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public."ProviderAvailabilityVisitType"
    OWNER to postgres;

COMMENT ON COLUMN public."ProviderAvailabilityVisitType"."ProviderAvailabilityVisitTypeId"
    IS ' ';