mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 17:41:15 +00:00
14 lines
460 B
MySQL
14 lines
460 B
MySQL
|
-- CreateTable
|
||
|
CREATE TABLE "Post" (
|
||
|
"id" TEXT NOT NULL,
|
||
|
"content" TEXT NOT NULL,
|
||
|
"authorId" TEXT NOT NULL,
|
||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
||
|
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
|
||
|
);
|
||
|
|
||
|
-- AddForeignKey
|
||
|
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|