shadcn.io is not affiliated with official shadcn/ui
Failed Database Migration Error Block for React
A migration ledger after a failed migration: five rows with their states, the database error in a numbered window, a retry that fails again, and a roll-back that says exactly what it reverts.
Installation
Overview
Show what a failed migration left behind, with this migration error for React with Base UI. A header sits over one framed panel. The first band is the migration ledger, five ruled rows each with its file name and a shape and a word (three applied, one failed, one pending), the counts, and an Undo. The second holds the database's error in a themed numbered window with a Copy Button, and a hairline strip with the schema version, the transaction's outcome, the database and the attempts. The foot has the one Shine Button, Retry the migration, and an outline Roll back the last migration, which opens an Alert Dialog that says exactly what it reverts and whether any data is lost. The frame and bands come from Guides, and the entrance is CSS only. For a schema-migration tool, a database console or a deploy pipeline.
FAQ
What is real here, and what stays local?
Nothing connects to a database. The ledger, the error and the facts are typed in the file, Retry waits a moment and fails again with the same error, and Roll back updates the ledger in the page only. The Copy button is real. To wire it for real, build the ledger from your tool's history table and send the buttons to your tool.
What does the dialog say, and why does it matter?
It names the migration, says what its down step does, and says whether that loses data: undoing a rename changes no rows, while undoing a table or a column deletes what is in it, and then the dialog says how many rows and the action turns destructive. It also says the failed migration changed nothing. Cancel is first and has focus when it opens, and Escape closes it.
Why did the failed migration change nothing?
Because it ran inside a transaction and was rolled back with it. That is true only on databases that can undo schema changes in a transaction, and for statements that can run in one, so check yours before you say the same on a real page.
Why does Retry fail again?
Because the cause is in the data, not a hiccup: two sessions claim the same user, so the unique constraint fails every time. The demo says so honestly instead of succeeding by accident, and each attempt is counted in the strip.
Related
- Pro
Database Backoff Schedule Error
Server and outagesA full-screen page for a database that refuses connections: Retry now and a switch that retries by itself on a press-started countdown, four pool cells and the backoff schedule drawn to scale.
- Pro
Deploy Rolled Back Error
Developer toolsA full-screen page for a rolled-back deploy: a line chart of one metric against its limit with the health check, rollback and recovery pinned to it, and a switch between three metrics.
- Pro
Failed Build Pipeline Error
Developer toolsA CI build window: five pipeline stages as tabs, each with its own numbered log, the failing line marked, a re-run that only queues, common fixes and the build id with Copy.
- Pro
Invalid Config File Error
Developer toolsA full-screen page for a config file that does not validate: a numbered, editable JSON window parsed as you type, the problems located by line and column, and one button that applies the fixes.
- Pro
Rollback Wizard Changelog
Deploys and rolloutsA three-step rollback wizard in one framed window: pick a previous release, review what reverts and what stays, then type the version to unlock a Shine Button that opens an alert dialog and ends on a stated demo result.
- Pro
Missing API Key Error
Developer toolsA full-screen page for a developer whose API key is missing: the steps to fix it, and a numbered .env window whose empty key line is marked and can be filled with a sample key that shows as a diff.