20 lines
554 B
MySQL
20 lines
554 B
MySQL
|
-- CreateTable
|
||
|
CREATE TABLE "User" (
|
||
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
"email" TEXT NOT NULL,
|
||
|
"name" TEXT
|
||
|
);
|
||
|
|
||
|
-- CreateTable
|
||
|
CREATE TABLE "Post" (
|
||
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
"title" TEXT NOT NULL,
|
||
|
"content" TEXT,
|
||
|
"published" BOOLEAN NOT NULL DEFAULT false,
|
||
|
"authorId" INTEGER NOT NULL,
|
||
|
CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||
|
);
|
||
|
|
||
|
-- CreateIndex
|
||
|
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|