20 lines
516 B
MySQL
20 lines
516 B
MySQL
|
-- 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,
|
||
|
FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||
|
);
|
||
|
|
||
|
-- CreateTable
|
||
|
CREATE TABLE "User" (
|
||
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
"email" TEXT NOT NULL,
|
||
|
"name" TEXT
|
||
|
);
|
||
|
|
||
|
-- CreateIndex
|
||
|
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
|