-- Schema: spider__csu_1
CREATE SCHEMA IF NOT EXISTS "spider__csu_1";

-- Table: Campuses
CREATE TABLE "spider__csu_1"."Campuses" (
    "Id" BIGINT NOT NULL,
    "Campus" TEXT,
    "Location" TEXT,
    "County" TEXT,
    "Year" BIGINT,
    CONSTRAINT "Campuses_pkey" PRIMARY KEY ("Id")
);

-- Table: csu_fees
CREATE TABLE "spider__csu_1"."csu_fees" (
    "Campus" BIGINT NOT NULL,
    "Year" BIGINT,
    "CampusFee" BIGINT,
    CONSTRAINT "csu_fees_pkey" PRIMARY KEY ("Campus")
);

-- Table: degrees
CREATE TABLE "spider__csu_1"."degrees" (
    "Year" BIGINT NOT NULL,
    "Campus" BIGINT NOT NULL,
    "Degrees" BIGINT,
    CONSTRAINT "degrees_pkey" PRIMARY KEY ("Year", "Campus")
);

-- Table: discipline_enrollments
CREATE TABLE "spider__csu_1"."discipline_enrollments" (
    "Campus" BIGINT NOT NULL,
    "Discipline" BIGINT NOT NULL,
    "Year" BIGINT,
    "Undergraduate" BIGINT,
    "Graduate" BIGINT,
    CONSTRAINT "discipline_enrollments_pkey" PRIMARY KEY ("Campus", "Discipline")
);

-- Table: enrollments
CREATE TABLE "spider__csu_1"."enrollments" (
    "Campus" BIGINT NOT NULL,
    "Year" BIGINT NOT NULL,
    "TotalEnrollment_AY" BIGINT,
    "FTE_AY" BIGINT,
    CONSTRAINT "enrollments_pkey" PRIMARY KEY ("Campus", "Year")
);

-- Table: faculty
CREATE TABLE "spider__csu_1"."faculty" (
    "Campus" BIGINT,
    "Year" BIGINT,
    "Faculty" DOUBLE PRECISION
);

-- Foreign Keys
ALTER TABLE "spider__csu_1"."csu_fees" ADD CONSTRAINT "fk_csu_fees_0" FOREIGN KEY ("Campus") REFERENCES "spider__csu_1"."Campuses" ("Id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__csu_1"."degrees" ADD CONSTRAINT "fk_degrees_0" FOREIGN KEY ("Campus") REFERENCES "spider__csu_1"."Campuses" ("Id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__csu_1"."discipline_enrollments" ADD CONSTRAINT "fk_discipline_enrollments_0" FOREIGN KEY ("Campus") REFERENCES "spider__csu_1"."Campuses" ("Id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__csu_1"."enrollments" ADD CONSTRAINT "fk_enrollments_0" FOREIGN KEY ("Campus") REFERENCES "spider__csu_1"."Campuses" ("Id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__csu_1"."faculty" ADD CONSTRAINT "fk_faculty_0" FOREIGN KEY ("Campus") REFERENCES "spider__csu_1"."Campuses" ("Id") ON DELETE NO ACTION ON UPDATE NO ACTION;
