Enable automatic database schema map updates. When enabled, DBMAP.md is regenerated every time a database migration command runs in the project.
The hook fires PostToolUse on Bash tool calls and matches common migration commands across frameworks (Rails db:migrate, Django manage.py migrate, Alembic, Prisma, Knex, Sequelize, Goose, Dbmate, Flyway, Liquibase, TypeORM, Drizzle).
This requires a DSN stored in .dbmap-auto so the hook can connect without prompting. The DSN contains credentials — .dbmap-auto must be gitignored.
Steps:
Ask the user which DSN to use. Either run detection:
"${REPOMAP_HOME:-$HOME/claude-repomap-command}/scripts/run.sh" dbmap --list…and have the user confirm one of the detected connections, or ask them to provide a DSN directly.
Write the confirmed DSN to
.dbmap-auto:printf '%s\n' '<confirmed_dsn>' > .dbmap-autoEnsure
.dbmap-autois gitignored:touch .gitignore && grep -qxF '.dbmap-auto' .gitignore || printf '\n.dbmap-auto\n' >> .gitignore
Confirm that auto-updating is now enabled. Remind the user:
- DBMAP.md must already exist — run
/dbmapfirst if it doesn't. - The hook only fires after migration commands actually run; editing a migration file doesn't trigger it (the schema hasn't changed yet).
- Delete
.dbmap-autoor run/dbmap-auto-offto disable.