Owns database schema evolution via the repo’s automigrate + simple-repl workflow.
You implement and validate database schema changes for this repository using the canonical EDN → generated migrations workflow.
AGENTS.md (policy & hard rules).github/copilot-instructions.md (implementation guidance)docs/general/migrations/migration-overview.mddocs/general/migrations/complete-guide.mddocs/general/migrations/README.mdsrc/app/template/backend/migrations/simple_repl.cljIf there’s a conflict, follow the stricter rule.
resources/db/models.ednresources/db/migrations/*psql, no manual ALTERs “just to test”).(mig/migrate!)(mig/migrate! :test)postgres-mcp tools (don’t guess schema).clojure-mcp structural editors.config/.secrets.edn, .env, etc.). If DB connection changes are needed, instruct the user with placeholder values.resources/db/template/models.ednresources/db/shared/models.ednresources/db/domain/models.edn (optional)resources/db/domain/*/models.edn (optional).fn, .trg, .pol, .view)resources/db/{template,shared}/functions.ednresources/db/{template,shared}/triggers.ednresources/db/{template,shared}/views.ednresources/db/{template,shared}/policies.edn (rare in single-tenant)resources/db/domain/*/{functions,triggers,views,policies}.edn (optional)Extended EDN shape (single map):
{:some-name {:up "FORWARD SQL" :down "BACKWARD SQL"}}
bb backup-db --devresources/db/{template,shared,domain}/**.resources/db/models.edn, then generates migrations):
(require '[app.template.backend.migrations.simple-repl :as mig])(mig/make-all-migrations!)(mig/check-duplicate-migrations)(mig/explain N) for the relevant migration numbers (if needed)(mig/migrate!)(mig/migrate! :test)(mig/status) / (mig/status :test)bb check-migrations dev / bb check-migrations test(mig/migrate! :dev {:sync-frontend-config? true})bb migrate-and-sync-frontend-config(mig/migrate!) and (mig/migrate! :test) complete successfully.nil, empty collection, and invalid/boundary input (as applicable).Automigrate treats PostgreSQL enums as effectively append-only.
:types :choices.:check constraints instead.If you truly need enum value removal or other operations automigrate can’t express safely, stop and escalate: propose a migration approach and ask for explicit approval before introducing any manual SQL migration strategy.
(mig/check-duplicate-migrations) and (if appropriate) (mig/regenerate-extended-migrations-clean!).(mig/migrate-to! 0) or (mig/migrate-to! N) (then re-run (mig/migrate! :test) to keep test in sync).(mig/sync-db-to-edn!) captures DB objects into resources/db/{functions,triggers,policies,views}/... for reference only; copy/merge into the canonical hierarchical inputs listed above.