tools db migrations - BevvyTech/BrewskiDocs GitHub Wiki
Tools – DB Migrations (/tools/db-migrations)
- Give super user operators a quick audit trail of every Prisma migration applied to production.
- Surface migration timing, duration, and rollback metadata without requiring database console access.
- Provide a one-click way to copy the Makefile rollback command for any migration when triaging issues.
- Navigation entry and page render only when the current membership reports
teamRoleType === "su".
- Non-super users attempting to reach the route are redirected back to
/tools.
- Standard admin breadcrumb (
Dashboard → Tools → DB Migrations) followed by an intro card.
- Card header contains a short description, a compact search input, and a refresh button.
- Main body renders an MUI table (size
small) listing migrations with status chips, timestamps, duration, and rollback timestamp.
- Table rows show the migration name, ID, and checksum in the first column to aid lookups.
- Search box filters client-side across migration name, status label, and ID (case-insensitive).
- Refresh button re-fetches the migrations list from the API while preserving any active filter.
-
Copy revert button writes make rollback <migration_name> to the clipboard and surfaces success/error snackbars.
- Status chips map
applied, running, pending, rolledBack to success/info/default/error colours for quick scanning.
- Duration column renders an
HH:MM:SS (or MM:SS) timestamp derived from startedAt/finishedAt when both are present.
-
dbBrowserService.listMigrations → GET /tools/db/migrations (requires super user membership).
- Relies on
navigator.clipboard.writeText for the copy action and notistack snackbars for feedback.
- Date/time formatting uses
Intl.DateTimeFormat so locale preferences carry through automatically.
⚠️ **GitHub.com Fallback** ⚠️