-- Obsidian Toolbox — факт использования генератора участником (аналитика)
CREATE TABLE "ToolUsage" (
    "id" TEXT NOT NULL,
    "userId" TEXT NOT NULL,
    "tool" TEXT NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT "ToolUsage_pkey" PRIMARY KEY ("id")
);

CREATE INDEX "ToolUsage_userId_idx" ON "ToolUsage"("userId");
CREATE INDEX "ToolUsage_tool_idx" ON "ToolUsage"("tool");
CREATE INDEX "ToolUsage_createdAt_idx" ON "ToolUsage"("createdAt");

ALTER TABLE "ToolUsage" ADD CONSTRAINT "ToolUsage_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
