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

-- Table: Activity
CREATE TABLE "spider__activity_1"."Activity" (
    "actid" BIGINT NOT NULL,
    "activity_name" TEXT,
    CONSTRAINT "Activity_pkey" PRIMARY KEY ("actid")
);

-- Table: Faculty
CREATE TABLE "spider__activity_1"."Faculty" (
    "FacID" BIGINT NOT NULL,
    "Lname" TEXT,
    "Fname" TEXT,
    "Rank" TEXT,
    "Sex" TEXT,
    "Phone" BIGINT,
    "Room" TEXT,
    "Building" TEXT,
    CONSTRAINT "Faculty_pkey" PRIMARY KEY ("FacID")
);

-- Table: Faculty_Participates_in
CREATE TABLE "spider__activity_1"."Faculty_Participates_in" (
    "FacID" BIGINT,
    "actid" BIGINT
);

-- Table: Participates_in
CREATE TABLE "spider__activity_1"."Participates_in" (
    "stuid" BIGINT,
    "actid" BIGINT
);

-- Table: Student
CREATE TABLE "spider__activity_1"."Student" (
    "StuID" BIGINT NOT NULL,
    "LName" TEXT,
    "Fname" TEXT,
    "Age" BIGINT,
    "Sex" TEXT,
    "Major" BIGINT,
    "Advisor" BIGINT,
    "city_code" TEXT,
    CONSTRAINT "Student_pkey" PRIMARY KEY ("StuID")
);

-- Foreign Keys
ALTER TABLE "spider__activity_1"."Faculty_Participates_in" ADD CONSTRAINT "fk_Faculty_Participates_in_0" FOREIGN KEY ("actid") REFERENCES "spider__activity_1"."Activity" ("actid") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__activity_1"."Faculty_Participates_in" ADD CONSTRAINT "fk_Faculty_Participates_in_1" FOREIGN KEY ("FacID") REFERENCES "spider__activity_1"."Faculty" ("FacID") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__activity_1"."Participates_in" ADD CONSTRAINT "fk_Participates_in_0" FOREIGN KEY ("actid") REFERENCES "spider__activity_1"."Activity" ("actid") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__activity_1"."Participates_in" ADD CONSTRAINT "fk_Participates_in_1" FOREIGN KEY ("stuid") REFERENCES "spider__activity_1"."Student" ("StuID") ON DELETE NO ACTION ON UPDATE NO ACTION;
