From 9dd7432e6b7e24da874e256eb58761f9e339acab Mon Sep 17 00:00:00 2001 From: dswbx Date: Thu, 18 Sep 2025 09:50:05 +0200 Subject: [PATCH] refactor: remove unique field validation from `EntityIndex` Eliminated validation requiring the first field in unique indices to be mandatory. This simplifies the logic as the requirement is no longer necessary. --- app/src/data/fields/indices/EntityIndex.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/app/src/data/fields/indices/EntityIndex.ts b/app/src/data/fields/indices/EntityIndex.ts index e8af2e6..ec69ecc 100644 --- a/app/src/data/fields/indices/EntityIndex.ts +++ b/app/src/data/fields/indices/EntityIndex.ts @@ -15,17 +15,6 @@ export class EntityIndex { throw new Error("All fields must be instances of Field"); } - if (unique) { - const firstRequired = fields[0]?.isRequired(); - if (!firstRequired) { - throw new Error( - `Unique indices must have first field as required: ${fields - .map((f) => f.name) - .join(", ")}`, - ); - } - } - if (!name) { this.name = [ unique ? "idx_unique" : "idx",