23 lines
670 B
MySQL
23 lines
670 B
MySQL
|
-- CreateTable
|
||
|
CREATE TABLE "Mention" (
|
||
|
"id" SERIAL NOT NULL,
|
||
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
||
|
"itemId" INTEGER NOT NULL,
|
||
|
"userId" INTEGER NOT NULL,
|
||
|
|
||
|
PRIMARY KEY ("id")
|
||
|
);
|
||
|
|
||
|
-- CreateIndex
|
||
|
CREATE INDEX "Mention.itemId_index" ON "Mention"("itemId");
|
||
|
|
||
|
-- CreateIndex
|
||
|
CREATE INDEX "Mention.userId_index" ON "Mention"("userId");
|
||
|
|
||
|
-- AddForeignKey
|
||
|
ALTER TABLE "Mention" ADD FOREIGN KEY ("itemId") REFERENCES "Item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||
|
|
||
|
-- AddForeignKey
|
||
|
ALTER TABLE "Mention" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|