HotTRDealsBackend/prisma/migrations/20260207101500_add_user_interest_profile/migration.sql
2026-02-09 21:47:55 +00:00

17 lines
666 B
SQL

-- CreateTable
CREATE TABLE "UserInterestProfile" (
"userId" INTEGER NOT NULL,
"categoryScores" JSONB NOT NULL DEFAULT '{}',
"totalScore" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "UserInterestProfile_pkey" PRIMARY KEY ("userId")
);
-- CreateIndex
CREATE INDEX "UserInterestProfile_updatedAt_idx" ON "UserInterestProfile"("updatedAt");
-- AddForeignKey
ALTER TABLE "UserInterestProfile" ADD CONSTRAINT "UserInterestProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;