-- SEQUENCE: public.DoctorAvailabilityVisitType_DoctorAvailabilityVisitTypeId_seq

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

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

ALTER SEQUENCE public."DoctorAvailabilityVisitType_DoctorAvailabilityVisitTypeId_seq"
    OWNER TO postgres;


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


-- Table: public.DoctorAvailabilityVisitType

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

CREATE TABLE IF NOT EXISTS public."DoctorAvailabilityVisitType"
(
    "DoctorAvailabilityVisitTypeId" integer NOT NULL DEFAULT nextval('"DoctorAvailabilityVisitType_DoctorAvailabilityVisitTypeId_seq"'::regclass),
    "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,
    "LocationId" integer,
    "ProviderId" integer,
    "SpecializationId" integer,
    CONSTRAINT "DoctorAvailabilityVisitType_pkey" PRIMARY KEY ("DoctorAvailabilityVisitTypeId"),
    CONSTRAINT "DoctorAvailabilityVisitType_LocationId_fkey" FOREIGN KEY ("LocationId")
        REFERENCES public."Location" ("LocationId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "DoctorAvailabilityVisitType_ProviderId_fkey" FOREIGN KEY ("ProviderId")
        REFERENCES public."Provider" ("ProviderId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "DoctorAvailabilityVisitType_SpecializationId_fkey" FOREIGN KEY ("SpecializationId")
        REFERENCES public."Specialization" ("SpecializationId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)

TABLESPACE pg_default;

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

COMMENT ON COLUMN public."DoctorAvailabilityVisitType"."DoctorAvailabilityVisitTypeId"
    IS ' ';