15 lines
468 B
MySQL
15 lines
468 B
MySQL
|
-- CreateTable
|
||
|
CREATE TABLE "Bookmark" (
|
||
|
"userId" INTEGER NOT NULL,
|
||
|
"itemId" INTEGER NOT NULL,
|
||
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
||
|
PRIMARY KEY ("userId","itemId")
|
||
|
);
|
||
|
|
||
|
-- AddForeignKey
|
||
|
ALTER TABLE "Bookmark" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||
|
|
||
|
-- AddForeignKey
|
||
|
ALTER TABLE "Bookmark" ADD FOREIGN KEY ("itemId") REFERENCES "Item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|