--- spec: agent-feature status: ready owner: feature-pipeline-agent related-routes: files: # (none listed) --- # agent-feature ## Goal Add a per-project UNIQUE constraint on the Name column of 5 existing project-scoped xyz tables: AssetType, SystemType, Asset, CommissioningSystem, and CommissioningWorkflow (the latter two are the actual table names for the spec's "System" and "Workflow"). Uniqueness is scoped per project — the constraint is composite (ProjectShardId, Name) — per reviewer guidance. DB-schema-only change owned by the Postgres repo; no API1/API2 code changes. ## Behavior changes The approved plan's API2 changes (verbatim): ```yaml none ... ``` ## Acceptance criteria - [ ] The behavior described above is implemented on the listed files. - [ ] Existing behavior is unchanged when the new feature is not exercised. - [ ] Unit and (where observable) e2e tests cover the new behavior. ## Out of scope - Any API1 or API2 code changes (DB-schema-only change) - Data migration / backfill / dedup scripts - Uniqueness on any column other than Name - Any tables beyond the 5 listed - Global (cross-project) uniqueness — uniqueness is scoped per project per reviewer guidance ## Notes / open questions - Generated by the feature pipeline from the approved architect plan. If any acceptance criterion is ambiguous, ask the human before implementing. ## Decisions - **No API2 code changes were made.** The spec is a DB-schema-only change (composite `UNIQUE (ProjectShardId, Name)` on 5 tables) and explicitly places "Any API1 or API2 code changes" out of scope, with `Behavior changes: none` and an empty `files:` list. Repo investigation confirmed this is the correct call: `platform-api` contains no schema/DDL/migrations — the Postgres schema is externally managed via Liquibase (`docker/distributed_changelog_local.xml` references `PostgreSQLDatabase/Database/xyz/Tables/` and `.../Constraints/`, which do not exist in this repo). The UNIQUE constraint must be added in the Postgres schema repo. The 5 affected entities (AssetType, SystemType, Asset, CommissioningSystem, CommissioningWorkflow) do not appear in `src/` on `master`; no create/insert endpoint exists here that the constraint would affect. Therefore there is no surgical edit, validator, controller, route, or test to add in this repo.