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

-- Table: Dish
CREATE TABLE "bird__menu"."Dish" (
    "id" BIGINT NOT NULL,
    "name" TEXT,
    "description" TEXT,
    "menus_appeared" BIGINT,
    "times_appeared" BIGINT,
    "first_appeared" BIGINT,
    "last_appeared" BIGINT,
    "lowest_price" DOUBLE PRECISION,
    "highest_price" DOUBLE PRECISION,
    CONSTRAINT "Dish_pkey" PRIMARY KEY ("id")
);

-- Table: Menu
CREATE TABLE "bird__menu"."Menu" (
    "id" BIGINT NOT NULL,
    "name" TEXT,
    "sponsor" TEXT,
    "event" TEXT,
    "venue" TEXT,
    "place" TEXT,
    "physical_description" TEXT,
    "occasion" TEXT,
    "notes" TEXT,
    "call_number" TEXT,
    "keywords" TEXT,
    "language" TEXT,
    "date" DATE,
    "location" TEXT,
    "location_type" TEXT,
    "currency" TEXT,
    "currency_symbol" TEXT,
    "status" TEXT,
    "page_count" BIGINT,
    "dish_count" BIGINT,
    CONSTRAINT "Menu_pkey" PRIMARY KEY ("id")
);

-- Table: MenuItem
CREATE TABLE "bird__menu"."MenuItem" (
    "id" BIGINT NOT NULL,
    "menu_page_id" BIGINT,
    "price" DOUBLE PRECISION,
    "high_price" DOUBLE PRECISION,
    "dish_id" BIGINT,
    "created_at" TEXT,
    "updated_at" TEXT,
    "xpos" DOUBLE PRECISION,
    "ypos" DOUBLE PRECISION,
    CONSTRAINT "MenuItem_pkey" PRIMARY KEY ("id")
);

-- Table: MenuPage
CREATE TABLE "bird__menu"."MenuPage" (
    "id" BIGINT NOT NULL,
    "menu_id" BIGINT,
    "page_number" BIGINT,
    "image_id" DOUBLE PRECISION,
    "full_height" BIGINT,
    "full_width" BIGINT,
    "uuid" TEXT,
    CONSTRAINT "MenuPage_pkey" PRIMARY KEY ("id")
);

-- Foreign Keys
ALTER TABLE "bird__menu"."MenuItem" ADD CONSTRAINT "fk_MenuItem_0" FOREIGN KEY ("menu_page_id") REFERENCES "bird__menu"."MenuPage" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
