stacker.news/prisma/migrations/20230212001152_bookmarks/migration.sql

15 lines
468 B
MySQL
Raw Normal View History

-- 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;