Data UI Backlog

Make secrets unique per user

The built-in :secrets type allowed duplicate names — even two identical (user, name) pairs. :user and :name are now both :identity t in *base-model*, so the compiler emits ix_secrets_identity (secret_user, secret_name): one secret per name per user, while different users may still use the same name. :secrets is never an FK / M2M target, so the "exactly one identity field" rule for referenced types does not apply.

Operational note (why the index did not appear after the edit): create-tables runs its DDL only when the table does not already exist, and the compensating drop in set-model (reset-tables) fires only from the second set-model of a session — the first one after an image restart sees (when *compiled-model* ...) nil and skips it. (hard-reset) does not help either: reset-database truncates only :base t tables and :secrets is :base nil. The live dev DB was repaired by creating the index manually (create unique index if not exists ix_secrets_identity on secrets (secret_user, secret_name); verified present via pg_indexes). This is the "idempotent database initialization" post-MVP gap in the flesh: schema changes to built-in types never reach an existing database.

Slot
17500
Status
60 Done
Tags
model, bug
Contributors
Donnie