feat(ST-bsjoqjnr): UserQuestion model + PLAN_CHAT enum-waarde
- Voeg PLAN_CHAT toe aan ClaudeJobKind enum - Voeg UserQuestionStatus enum toe (pending, answered) - Voeg UserQuestion model toe met idea_id, user_id, question, answer, status - Koppel user_questions relatie aan Idea model - Migratie: 20260505120000_add_user_question_plan_chat Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
881ee007e5
commit
8bccb56b21
2 changed files with 55 additions and 3 deletions
|
|
@ -0,0 +1,28 @@
|
||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "UserQuestionStatus" AS ENUM ('pending', 'answered');
|
||||||
|
|
||||||
|
-- AlterEnum
|
||||||
|
ALTER TYPE "ClaudeJobKind" ADD VALUE 'PLAN_CHAT';
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "user_questions" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"idea_id" TEXT NOT NULL,
|
||||||
|
"user_id" TEXT NOT NULL,
|
||||||
|
"question" TEXT NOT NULL,
|
||||||
|
"answer" TEXT,
|
||||||
|
"status" "UserQuestionStatus" NOT NULL DEFAULT 'pending',
|
||||||
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "user_questions_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "user_questions_idea_id_status_idx" ON "user_questions"("idea_id", "status");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "user_questions_user_id_idx" ON "user_questions"("user_id");
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "user_questions" ADD CONSTRAINT "user_questions_idea_id_fkey" FOREIGN KEY ("idea_id") REFERENCES "ideas"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
@ -90,6 +90,7 @@ enum ClaudeJobKind {
|
||||||
TASK_IMPLEMENTATION
|
TASK_IMPLEMENTATION
|
||||||
IDEA_GRILL
|
IDEA_GRILL
|
||||||
IDEA_MAKE_PLAN
|
IDEA_MAKE_PLAN
|
||||||
|
PLAN_CHAT
|
||||||
}
|
}
|
||||||
|
|
||||||
enum IdeaLogType {
|
enum IdeaLogType {
|
||||||
|
|
@ -101,6 +102,11 @@ enum IdeaLogType {
|
||||||
JOB_EVENT
|
JOB_EVENT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum UserQuestionStatus {
|
||||||
|
pending
|
||||||
|
answered
|
||||||
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
username String @unique
|
username String @unique
|
||||||
|
|
@ -409,9 +415,10 @@ model Idea {
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
updated_at DateTime @updatedAt
|
||||||
|
|
||||||
questions ClaudeQuestion[]
|
questions ClaudeQuestion[]
|
||||||
jobs ClaudeJob[]
|
jobs ClaudeJob[]
|
||||||
logs IdeaLog[]
|
logs IdeaLog[]
|
||||||
|
user_questions UserQuestion[]
|
||||||
|
|
||||||
@@unique([user_id, code])
|
@@unique([user_id, code])
|
||||||
@@index([user_id, archived, status])
|
@@index([user_id, archived, status])
|
||||||
|
|
@ -432,6 +439,23 @@ model IdeaLog {
|
||||||
@@map("idea_logs")
|
@@map("idea_logs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model UserQuestion {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
idea_id String
|
||||||
|
user_id String
|
||||||
|
question String @db.Text
|
||||||
|
answer String? @db.Text
|
||||||
|
status UserQuestionStatus @default(pending)
|
||||||
|
created_at DateTime @default(now())
|
||||||
|
updated_at DateTime @updatedAt
|
||||||
|
|
||||||
|
idea Idea @relation(fields: [idea_id], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@index([idea_id, status])
|
||||||
|
@@index([user_id])
|
||||||
|
@@map("user_questions")
|
||||||
|
}
|
||||||
|
|
||||||
model LoginPairing {
|
model LoginPairing {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
secret_hash String
|
secret_hash String
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue