Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(dataset-versioning): switch pk (#10982)

marliessophie62f28e9fed97
diff --git a/packages/shared/prisma/migrations/20251211204006_dataset_items_switch_pk/migration.sql b/packages/shared/prisma/migrations/20251211204006_dataset_items_switch_pk/migration.sql
new file mode 100644
index 0000000000..d480021fd9
--- /dev/null
+++ b/packages/shared/prisma/migrations/20251211204006_dataset_items_switch_pk/migration.sql
@@ -0,0 +1,9 @@
+/*
+ Warnings:
+
+ - The primary key for the `dataset_items` table will be changed. If it partially fails, the table could be left without primary key constraint.
+
+*/
+-- AlterTable
+ALTER TABLE "dataset_items" DROP CONSTRAINT "dataset_items_pkey",
+ADD CONSTRAINT "dataset_items_pkey" PRIMARY KEY USING INDEX "dataset_items_id_project_id_valid_from_key";
diff --git a/packages/shared/prisma/schema.prisma b/packages/shared/prisma/schema.prisma
index 79324eb834..4cf4545d2f 100644
--- a/packages/shared/prisma/schema.prisma
+++ b/packages/shared/prisma/schema.prisma
@@ -633,8 +633,7 @@ model DatasetItem {
validFrom DateTime @default(now()) @map("valid_from")
isDeleted Boolean @default(false) @map("is_deleted")
- @@id([id, projectId])
- @@unique([id, projectId, validFrom])
+ @@id([id, projectId, validFrom])
@@index([sourceTraceId], type: Hash)
@@index([sourceObservationId], type: Hash)
@@index([datasetId], type: Hash)