Migration assurance

Migration assurance

Know what a database migration will do before it runs.

A CI pipeline where the migration gate holds an unapproved high-risk migration

Open Reliability Intelligence → Migration assurance. The analysis is rule-based and makes no AI model calls.

Warning:TicketResolve never runs a migration and never connects to your database. Your pipeline runs the migration and the validation queries. TicketResolve analyses the files, keeps the approvals and records what your pipeline reports.

Submit a migration

Choose Check a migration and paste or upload the files, or send them from CI with the CLI (below). Supported formats:

FormatWhat is readRollback taken from
Plain SQL (PostgreSQL, MySQL, SQL Server)Every statement, including multi-action ALTER TABLE and GO batchesA rollback script you supply
FlywayV…__name.sql filesA matching U…__ undo file
Liquibase (XML, YAML)Each change in each changeSet, and embedded SQLrollback blocks, or changes Liquibase can reverse itself
Prisma Migratemigration.sqlNone: Prisma has no down migrations
Alembicop.* and batch_op.* calls in upgrade(), and op.execute SQLA downgrade() that does something
Djangomigrations.* operations, and RunSQLAutomatic for schema changes; RunSQL and RunPython need a reverse
Entity Framework CoremigrationBuilder.* calls in Up(), and Sql()A Down() with operations
Rails, Knex, TypeORMSchema calls and raw SQLdown methods, or reversible change steps (Rails)

Give the service, environment and repository so TicketResolve can check the code that’s deployed. Secrets in the files are masked before they’re stored. Submitting the same files again returns the same migration.

What the analysis shows

  • Each operation, with its file and line, classified as additive, destructive (drops or deletes data), breaking (old code fails, such as a rename or a NOT NULL column without a default), locking (index builds, foreign keys, type changes), a data change, or something to review by hand. Each one says what it affects and a safer way to do it.
  • Code that still uses it: for dropped or renamed tables and columns, the places in your indexed code that still reference them. The deployed commit is used when your deployments report it; otherwise the latest index, and the page says so. Test files are left out.
  • Rollback readiness: ready, partial or not ready, with the reasons. Steps that delete data can’t be undone by a down migration; only a backup brings the data back.
  • Risk score, 0–100, with every factor and its points. For example: +30 for dropping a column, +25 if the code still uses it, +25 for a NOT NULL column without a default, +10 for an index build that blocks writes, +15 with no working rollback, +10 in production. Low below 20, medium below 45, high below 70, critical from 70.

Validation

For each migration, TicketResolve writes read-only queries that return one number: rows in each table, NULLs where a column becomes NOT NULL, duplicates where a unique constraint is added, rows pointing to a missing parent for a new foreign key, values too long for a narrower column, and data a dropped column still holds. Blocking checks must find nothing before the migration can be approved.

After the run, the post-migration checks compare row counts with the numbers from before. A table that lost rows it shouldn’t have fails the check.

Every query must be a single SELECT that returns one aggregate (COUNT, MAX or MIN). It can contain no strings, comments or functions that write, wait or read files. The server applies this rule, and so does the CLI before it runs anything.

Approvals and the workflow

StepWhat happens
Detected → AnalysedFiles received and analysed.
ValidatedPre-migration results recorded.
In review → ApprovedApprovers can’t be the person who submitted it, and each person counts once. Critical risk, or high risk or data loss in production, needs two approvals. Medium risk, or anything in production, needs one. Low risk outside production needs none.
ScheduledOptional: when it will run.
Running → RanReported by your pipeline (or recorded by hand).
Checked → CompletedPost-migration results recorded, then completed. Completing without them, or with failures, needs a reason.
  • A blocking validation failure stops approval. An administrator can override it with a reason of at least 10 characters.
  • A high- or critical-risk migration can’t be approved without validation unless the approver confirms it.
  • If validation fails after approval, the approvals are withdrawn. If a new analysis raises the risk, they are withdrawn too.
  • A run reported without the required approvals is still recorded, and raises a critical finding that goes to the owner and administrators.
  • Findings are also raised for high-risk migrations waiting for approval, conflicts with the code, failed validation and failed runs.
  • The release check lists unapproved high-risk migrations for the service and recommends caution.

From CI

Download tr-migrations.mjs (Node 18+) and set TR_API_KEY:

  • node tr-migrations.mjs submit --service api --env production --repo acme/api --ref $GIT_SHA db/migration/V12__x.sql prints the id and risk. Add --fail-on high to stop the pipeline at that level.
  • TR_DB_URL=postgres://readonly:…@db/app node tr-migrations.mjs validate 42 runs the checks in a READ ONLY transaction with a 15-second timeout and sends back only the numbers. Use a database user that can only read. On SQL Server there is no read-only transaction, so the user must be db_datareader only.
  • node tr-migrations.mjs gate 42 exits non-zero unless the migration is approved. Put it right before the step that runs the migration.
  • node tr-migrations.mjs report 42 --status succeeded (or started, failed, rolled_back), then validate 42 --phase post.

API: GET|POST /v1/reliability/migrations, GET /v1/reliability/migrations/:id, GET …/:id/plan?phase=pre|post, POST …/:id/validation, POST …/:id/execution. Approvals stay in the dashboard. See the API reference.