mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
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.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user