On this page
What this issue is
A database migration is a script that changes your database structure: adding a column, creating a table, changing a data type. It usually runs during a deploy, just before or after the new code goes live.
A migration fails silently when it errors, times out or only half-runs, and nobody is told. The deploy still shows green. Common causes: the migration step was skipped in the pipeline, the error was swallowed by a script that returns exit code 0, a lock or timeout stopped it midway, or it ran against the wrong database.
Why it costs you leads or sales
Pages may still load, so the site looks fine. But the parts that touch the database break: saving a lead, creating an order, applying a coupon, logging in. Visitors see a generic error, a spinner that never ends, or a thank-you page for a lead that was never stored.
- Ad clickVisitor lands on page
- Form submittedNew code sends the data
- Database writeColumn missing, query fails
- Lead in CRMNever created
- Follow-upNobody knows to call
The migration breaks the save step; everything after it is lost.
Example: illustrative numbers showing leads dropping to zero after a deploy with a failed migration.
How to check if your site has it
Read the deploy log
Find the migration step in your CI/CD or host log. Look for errors, timeouts, 'skipped' or a missing step altogether.
Check migration status
Run your framework's status command (for example
php artisan migrate:status,rails db:migrate:status,python manage.py showmigrations,npx prisma migrate status). Look for pending or failed entries.Compare the schema
Connect to the production database and confirm the new column, table or index exists and has the right type.
Check application error logs
Search for messages such as 'column does not exist', 'unknown column', 'no such table' or 'relation does not exist' since the deploy time.
Submit a test lead and order
Fill in your real form, then check the database and CRM for the record. Do not rely on the thank-you page alone.
grep -iE "unknown column|does not exist|no such table|undefined column" /var/log/app/*.log | tail -n 50How to fix it
Back up the database first. Then apply the fix that matches the cause. The exact commands depend on your framework or platform.
Back up the database
Export it from your host panel or a backup plugin before touching anything.
Re-run the plugin or theme update
Many plugins run their table changes on update or activation. Deactivate and reactivate the plugin, or open its settings page, and check for a 'database update' notice.
Verify the tables
In phpMyAdmin or Adminer, confirm the expected tables and columns exist. Enable WP_DEBUG_LOG in wp-config.php to see database errors in wp-content/debug.log.
Back up, then check status
Take a backup, then run your migration tool's status command against production.
Apply pending migrations
Run the apply command (for example
php artisan migrate --force,rails db:migrate,python manage.py migrate,npx prisma migrate deploy). Read the output for errors.Repair a half-applied migration
If it stopped midway, inspect what was applied. Fix the data or schema by hand, or write a new corrective migration. Avoid editing old migration files that have already run elsewhere.
Make the pipeline fail loudly
Ensure the migration step returns a non-zero exit code on error and that the deploy stops. Remove any '|| true' that hides failures.
Know what applies
Shopify manages its own database, so you cannot run migrations there. The equivalent is a failed app or theme update, or a custom app with its own database.
Check your custom app or middleware
If you host an app that talks to Shopify, apply the fix in the Custom code tab to that app's database.
#!/usr/bin/env bash
set -euo pipefail
# Any failing command below stops the deploy
npx prisma migrate deploy
./restart-app.shSilent failure
- Migration errors are swallowed
- Deploy shows green
- Forms fail until someone notices
Fails loudly
- Pipeline stops on a migration error
- Team is alerted at once
- A test lead confirms the save works
How to confirm it's fixed
- Migration status shows no pending or failed entries
- The new column or table exists in production with the right type
- No new schema errors in the application log
- A test form submission appears in the database, inbox and CRM
- A test order or booking is created end to end (use test mode for payments)
- Old leads lost during the gap are recovered from logs, backups or ad platform lead exports where possible
How to prevent it happening again
- Run migrations as a required pipeline step that blocks the release on failure
- Test migrations on a staging copy of production data first
- Keep migrations small, reversible and backwards compatible
- Add a post-deploy smoke test that saves a record
- Alert on spikes of database errors in your logs
- Avoid deploying during peak ad hours so problems cost less
- Record every deploy in a changelog
14:00
Deploy finishes and shows green. Migration timed out unseen.
14:05
New form code writes to a column that does not exist.
Next morning
Sales notices no new leads.
Next morning +1h
Migration re-run, test lead saved.
How FunnelGuard handles this
FunnelGuard detects this only partly. It cannot see your migration tool, deploy log or database schema. What it does is run your real customer journeys on a schedule, such as a lead form or checkout, and check each step. It also checks whether the test lead reaches your inbox and CRM. If a failed migration breaks the form or stops the lead arriving, the journey fails. A failure is re-checked from a second region, then you get one alert with a screenshot and a likely cause.
What it does not check: whether a migration ran, pending or half-applied migrations, schema differences, or database errors on parts of your site that no monitored journey touches. It also cannot tell you that a migration problem is the cause, only that a journey broke.
To cover the rest by hand: add a migration status check and a non-zero exit on failure to your pipeline, watch your logs for schema errors, and run a manual test lead after every deploy that includes a migration. Test traffic from FunnelGuard is marked (utm_source=funnelguard, fg_test=1), so you can filter those test records out of your data. The Free plan covers 1 site and 2 journeys with daily checks, and paid plans have a 3-day free trial.
Questions people ask
How do I know if a database migration failed?
Check your deploy log for errors, then run your framework's migration status command to look for pending or failed migrations. Confirm in the production database that the new column or table exists. Also search application logs for 'column does not exist' or 'no such table' errors.
Why did my deploy succeed but the form stopped saving leads?
The code likely expects a database change that never applied. The deploy only checks that the new code started, not that the migration completed. The form then fails on the missing column, or an error handler hides the failure.
Why is my migration only partly applied?
A timeout, table lock, crash or error midway can leave some changes applied and others not. This is more likely on large tables and on databases that cannot roll back schema changes inside a transaction. Inspect the schema and fix it with a corrective migration.
How do I stop migrations failing silently in CI/CD?
Make the migration a required step that returns a non-zero exit code on error, and stop the deploy when it does. Remove any commands that ignore failures, such as '|| true'. Add a post-deploy test that saves a real record.
Can I roll back a failed database migration?
Sometimes. If you wrote a down or reverse migration, you can run it, but only after checking what was actually applied. Restoring a backup is the safe fallback, though it may lose data written since the backup.
Can FunnelGuard detect a failed database migration?
Only partly. It does not read your migrations or schema, but it runs your lead form or checkout on a schedule and alerts you if the journey fails or the test lead does not reach your inbox or CRM. That catches the visible effect, not the cause.
Do I need a backup before fixing a migration?
Yes. Take a full backup before re-running or repairing any migration, because changes to a live database can be hard to undo. Test the fix on a staging copy if you can.
Related issues
- OPS-292Deploy broke landing page or formFix guide
- OPS-299Environment variable missing after redeployFix guide
- OPS-294Rollback needed but no previous versionFix guide
- OPS-295Staging config in production (API URLs, test keys)Fix guide
- OPS-307Change made without changelog (no root-cause trace)Fix guide
- OPS-308Deploys during peak ad hoursFix guide