You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
632 B
26 lines
632 B
2 years ago
|
-- CreateTable
|
||
|
CREATE TABLE "User" (
|
||
|
"id" SERIAL NOT NULL,
|
||
|
"email" TEXT NOT NULL,
|
||
|
"name" TEXT,
|
||
|
|
||
|
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
||
|
);
|
||
|
|
||
|
-- CreateTable
|
||
|
CREATE TABLE "Post" (
|
||
|
"id" SERIAL NOT NULL,
|
||
|
"title" TEXT NOT NULL,
|
||
|
"content" TEXT,
|
||
|
"published" BOOLEAN NOT NULL DEFAULT false,
|
||
|
"authorId" INTEGER NOT NULL,
|
||
|
|
||
|
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
|
||
|
);
|
||
|
|
||
|
-- CreateIndex
|
||
|
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||
|
|
||
|
-- AddForeignKey
|
||
|
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|