feat(ST-507): add optional code fields to Product, Pbi and Story

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-04-26 20:36:26 +02:00
parent c45ba1d0c2
commit 33d66bc7c4
3 changed files with 16 additions and 1 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 334 KiB

Before After
Before After

View file

@ -0,0 +1,9 @@
-- AlterTable
ALTER TABLE "products" ADD COLUMN "code" VARCHAR(30);
ALTER TABLE "pbis" ADD COLUMN "code" VARCHAR(30);
ALTER TABLE "stories" ADD COLUMN "code" VARCHAR(30);
-- CreateIndex
CREATE UNIQUE INDEX "products_user_id_code_key" ON "products"("user_id", "code");
CREATE UNIQUE INDEX "pbis_product_id_code_key" ON "pbis"("product_id", "code");
CREATE UNIQUE INDEX "stories_product_id_code_key" ON "stories"("product_id", "code");

View file

@ -95,6 +95,7 @@ model Product {
user User @relation(fields: [user_id], references: [id], onDelete: Cascade) user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
user_id String user_id String
name String name String
code String? @db.VarChar(30)
description String? description String?
repo_url String? repo_url String?
definition_of_done String definition_of_done String
@ -108,6 +109,7 @@ model Product {
members ProductMember[] members ProductMember[]
@@unique([user_id, name]) @@unique([user_id, name])
@@unique([user_id, code])
@@index([user_id, archived]) @@index([user_id, archived])
@@map("products") @@map("products")
} }
@ -116,6 +118,7 @@ model Pbi {
id String @id @default(cuid()) id String @id @default(cuid())
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade) product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
product_id String product_id String
code String? @db.VarChar(30)
title String title String
description String? description String?
priority Int priority Int
@ -124,6 +127,7 @@ model Pbi {
updated_at DateTime @updatedAt updated_at DateTime @updatedAt
stories Story[] stories Story[]
@@unique([product_id, code])
@@index([product_id, priority, sort_order]) @@index([product_id, priority, sort_order])
@@map("pbis") @@map("pbis")
} }
@ -138,6 +142,7 @@ model Story {
sprint_id String? sprint_id String?
assignee User? @relation("StoryAssignee", fields: [assignee_id], references: [id], onDelete: SetNull) assignee User? @relation("StoryAssignee", fields: [assignee_id], references: [id], onDelete: SetNull)
assignee_id String? assignee_id String?
code String? @db.VarChar(30)
title String title String
description String? description String?
acceptance_criteria String? acceptance_criteria String?
@ -149,6 +154,7 @@ model Story {
logs StoryLog[] logs StoryLog[]
tasks Task[] tasks Task[]
@@unique([product_id, code])
@@index([pbi_id, priority, sort_order]) @@index([pbi_id, priority, sort_order])
@@index([sprint_id, sort_order]) @@index([sprint_id, sort_order])
@@index([product_id, status]) @@index([product_id, status])