-- SEQUENCE: public.SessionType_SessionTypeId_seq

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

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

ALTER SEQUENCE public."SessionType_SessionTypeId_seq"
    OWNER TO postgres;



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

-- Table: public.SessionType

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

CREATE TABLE IF NOT EXISTS public."SessionType"
(
    "SessionTypeId" integer NOT NULL DEFAULT nextval('"SessionType_SessionTypeId_seq"'::regclass),
    "Name" character varying(150) COLLATE pg_catalog."default",
    "Active" boolean NOT NULL,
    "CreatedBy" integer NOT NULL,
    "CreatedDate" timestamp(6) without time zone,
    "ModifiedBy" integer,
    "ModifiedDate" timestamp(6) without time zone,
    CONSTRAINT "SessionTypeId_pkey" PRIMARY KEY ("SessionTypeId")
)

TABLESPACE pg_default;

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

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

-- SEQUENCE: public.Session_SessionId_seq

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

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

ALTER SEQUENCE public."Session_SessionId_seq"
    OWNER TO postgres;
----------------------------------------------------------------------------------------------------------------
-- Table: public.Session

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

CREATE TABLE IF NOT EXISTS public."Session"
(
    "SessionId" integer NOT NULL DEFAULT nextval('"Session_SessionId_seq"'::regclass),
    "ProviderId" integer,
    "Date" date,
    "StartTime" time without time zone,
    "EndTime" time without time zone,
    "AvailabilityCount" integer,
    "Banner" character varying COLLATE pg_catalog."default",
    "LocationId" integer,
    "SessionTypeId" integer,
    "Active" boolean NOT NULL,
    "CreatedBy" integer NOT NULL,
    "CreatedDate" timestamp(6) without time zone,
    "ModifiedBy" integer,
    "ModifiedDate" timestamp(6) without time zone,
    CONSTRAINT "SessionId_pkey" PRIMARY KEY ("SessionId"),
    CONSTRAINT "Session_CreatedBy_fkey" FOREIGN KEY ("CreatedBy")
        REFERENCES public."Account" ("AccountId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "Session_LocationId_fkey" FOREIGN KEY ("LocationId")
        REFERENCES public."Location" ("LocationId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "Session_ModifiedBy_fkey" FOREIGN KEY ("ModifiedBy")
        REFERENCES public."Account" ("AccountId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "Session_ProviderId_fkey" FOREIGN KEY ("ProviderId")
        REFERENCES public."Provider" ("ProviderId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION,
    CONSTRAINT "Session_SessionTypeId_fkey" FOREIGN KEY ("SessionTypeId")
        REFERENCES public."SessionType" ("SessionTypeId") MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public."Session"
    OWNER to postgres;
--------------------------------------------------------------------------------------------------------------------------------