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

-- Table: museum
CREATE TABLE "spider__museum_visit"."museum" (
    "Museum_ID" BIGINT NOT NULL,
    "Name" TEXT,
    "Num_of_Staff" BIGINT,
    "Open_Year" TEXT,
    CONSTRAINT "museum_pkey" PRIMARY KEY ("Museum_ID")
);

-- Table: visit
CREATE TABLE "spider__museum_visit"."visit" (
    "Museum_ID" BIGINT NOT NULL,
    "visitor_ID" TEXT NOT NULL,
    "Num_of_Ticket" BIGINT,
    "Total_spent" DOUBLE PRECISION,
    CONSTRAINT "visit_pkey" PRIMARY KEY ("Museum_ID", "visitor_ID")
);

-- Table: visitor
CREATE TABLE "spider__museum_visit"."visitor" (
    "ID" BIGINT NOT NULL,
    "Name" TEXT,
    "Level_of_membership" BIGINT,
    "Age" BIGINT,
    CONSTRAINT "visitor_pkey" PRIMARY KEY ("ID")
);

-- Foreign Keys
ALTER TABLE "spider__museum_visit"."visit" ADD CONSTRAINT "fk_visit_1" FOREIGN KEY ("Museum_ID") REFERENCES "spider__museum_visit"."museum" ("Museum_ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
