25 lines
690 B
SQL
25 lines
690 B
SQL
-- CreateTable
|
|
CREATE TABLE "Comic" (
|
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
"slug" TEXT NOT NULL,
|
|
"title" TEXT NOT NULL,
|
|
"url" TEXT NOT NULL
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "ComicPage" (
|
|
"id" INTEGER NOT NULL,
|
|
"comicId" INTEGER NOT NULL,
|
|
"title" TEXT NOT NULL,
|
|
"url" TEXT NOT NULL,
|
|
"imageUrl" TEXT NOT NULL,
|
|
|
|
PRIMARY KEY ("comicId", "id"),
|
|
CONSTRAINT "ComicPage_comicId_fkey" FOREIGN KEY ("comicId") REFERENCES "Comic" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "Comic_slug_key" ON "Comic"("slug");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "ComicPage_comicId_id_key" ON "ComicPage"("comicId", "id");
|