-- SEQUENCE: public.ProviderAvailabilitySlot_ProviderAvailabilitySlotId_seq

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

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

ALTER SEQUENCE public."ProviderAvailabilitySlot_ProviderAvailabilitySlotId_seq"
    OWNER TO postgres;


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

-- Table: public.ProviderAvailabilitySlot

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

CREATE TABLE IF NOT EXISTS public."ProviderAvailabilitySlot"
(
    "ProviderAvailabilitySlotId" integer NOT NULL DEFAULT nextval('"ProviderAvailabilitySlot_ProviderAvailabilitySlotId_seq"'::regclass),
    "ProviderAvailabilityId" integer NOT NULL,
    "SpecializationId" integer NOT NULL,
    "AvailableDay" text COLLATE pg_catalog."default",
    "StartTime" text COLLATE pg_catalog."default",
    "EndTime" text COLLATE pg_catalog."default",
    "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,
    "FreeFollowUpDaysLimit" integer,
    "FreeFollowUpDays" integer,
    CONSTRAINT "ProviderAvailabilitySlot_pkey" PRIMARY KEY ("ProviderAvailabilitySlotId"),
    CONSTRAINT "FK_ProviderAvailabilitySlot_ProviderAvailabilityId" FOREIGN KEY ("ProviderAvailabilityId")
        REFERENCES public."ProviderAvailability" ("ProviderAvailabilityId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE CASCADE,
    CONSTRAINT "ProviderAvailabilitySlot_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."ProviderAvailabilitySlot"
    OWNER to postgres;

COMMENT ON COLUMN public."ProviderAvailabilitySlot"."ProviderAvailabilitySlotId"
    IS ' ';