-- CreateTable
CREATE TABLE "Sub" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "storyId" INTEGER NOT NULL,
    "pubId" INTEGER NOT NULL,
    "submitted" TEXT NOT NULL,
    "responded" TEXT NOT NULL,
    "responseId" INTEGER NOT NULL,
    CONSTRAINT "Sub_storyId_fkey" FOREIGN KEY ("storyId") REFERENCES "Story" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
    CONSTRAINT "Sub_pubId_fkey" FOREIGN KEY ("pubId") REFERENCES "Pub" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
    CONSTRAINT "Sub_responseId_fkey" FOREIGN KEY ("responseId") REFERENCES "Response" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

-- CreateTable
CREATE TABLE "PubsGenres" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "pubId" INTEGER NOT NULL,
    "genreId" INTEGER NOT NULL,
    CONSTRAINT "PubsGenres_pubId_fkey" FOREIGN KEY ("pubId") REFERENCES "Pub" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
    CONSTRAINT "PubsGenres_genreId_fkey" FOREIGN KEY ("genreId") REFERENCES "Genre" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

-- CreateTable
CREATE TABLE "StoriesGenres" (
    "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "storyId" INTEGER NOT NULL,
    "genreId" INTEGER NOT NULL,
    CONSTRAINT "StoriesGenres_storyId_fkey" FOREIGN KEY ("storyId") REFERENCES "Story" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
    CONSTRAINT "StoriesGenres_genreId_fkey" FOREIGN KEY ("genreId") REFERENCES "Genre" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
