feat/backend-unique-properties #33

Merged
crapougnax merged 5 commits from feat/backend-unique-properties into develop 2026-11-14 16:48:24 +00:00
Owner
No description provided.
A property can now be declared `unique: true`. Backends able to do so
refuse a second record of the collection holding the same value, at
creation and at update, including under concurrent writes.

- core: `unique` option and getter on properties;
- types: ConflictError, for writes colliding with the current state;
- backend: UniqueConstraintError (collection, property) and
  uniquePropertyNames(); the mock adapter enforces the rule;
- backend-postgres, backend-sqlite: UNIQUE column in created tables and
  generated migrations, constraint violations mapped to
  UniqueConstraintError.

Missing values may repeat. Soft-deleted records keep their value: it is
not reusable. Tables that already exist are not altered: add the
constraint with a migration. Adapters that do not implement the option
(Firestore, REST) ignore it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
fix(backend-sqlite): report a record identifier already taken as a unique violation
Some checks failed
Quatrain Core Sovereign CI / Monorepo Build, Tests & Quality Audit (push) Has started running
Quatrain Core Sovereign CI / Publish Changed Packages to npm (push) Has been cancelled
15e1604b67
Creating a record with an explicit identifier that already exists threw
a generic BackendError on SQLite, and a UniqueConstraintError on
PostgreSQL. Both adapters now throw UniqueConstraintError, without a
property name since the collision is on the identifier.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
test(backend-postgres): create the complete users table whichever test runs first
Some checks failed
Quatrain Core Sovereign CI / Monorepo Build, Tests & Quality Audit (push) Successful in 5m56s
Quatrain Core Sovereign CI / Publish Changed Packages to npm (push) Has been skipped
Quatrain Core Sovereign CI / Monorepo Build, Tests & Quality Audit (pull_request) Has been cancelled
Quatrain Core Sovereign CI / Publish Changed Packages to npm (pull_request) Has been cancelled
214f52a14e
On an empty database, a test whose model only refers to users made the
adapter create a placeholder users table with a single column; the tests
running afterwards then failed on missing columns. The shared test setup
now registers the User class, so the table is created complete.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Merge branch 'develop' into feat/backend-unique-properties
All checks were successful
Quatrain Core Sovereign CI / Monorepo Build, Tests & Quality Audit (push) Successful in 5m23s
Quatrain Core Sovereign CI / Publish Changed Packages to npm (push) Has been skipped
Quatrain Core Sovereign CI / Monorepo Build, Tests & Quality Audit (pull_request) Successful in 4m0s
Quatrain Core Sovereign CI / Publish Changed Packages to npm (pull_request) Has been skipped
3ff5b39185
Merge branch 'develop' into feat/backend-unique-properties
All checks were successful
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (push) Successful in 6m35s
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (pull_request) Successful in 6m40s
Quatrain Core CI / Publish Changed Packages to npm (push) Has been skipped
Quatrain Core CI / Publish Changed Packages to npm (pull_request) Has been skipped
5595d60040
crapougnax merged commit ca470309e7 into develop 2026-11-14 16:48:24 +00:00
crapougnax deleted branch feat/backend-unique-properties 2026-11-14 16:48:25 +00:00
Sign in to join this conversation.
No description provided.