Database migrations

A database migration changes the structure or contents of production data. Tokay treats that change as part of the deployment, but tests it against a copy first so the decision to touch production is based on evidence rather than the command alone.

Last updated

Rehearsal shows what the migration will do

When a deploy includes a migration, Tokay runs the command against a writable copy of the database before production changes.

The rehearsal records whether the command completed, how the schema changed, and whether tables or columns containing data would be removed. A failed rehearsal blocks the migration because it has not shown that the change can complete safely.

Destructive changes wait for approval

A migration that adds or changes structures without deleting data can continue after a successful rehearsal. When the rehearsal finds a destructive change, the Go Live phase pauses and shows the command, the detected changes, and the data at risk.

Production is unchanged while the deploy waits. Confirm the migration to continue, or leave it blocked and change the code. An AI agent should surface this decision to a person rather than confirming it automatically.

A snapshot protects the approved change

Before an approved destructive migration runs against production, Tokay takes a database snapshot. Restoring that snapshot is an explicit recovery action if the application or data behaves differently than the rehearsal predicted.

Release safety controls the approval boundary

Release safety is a Project setting inherited by its Services. The default rehearses migrations and asks for approval only when the change is destructive.

You can require approval for every migration. You can also allow migrations to run without the gate when they target an external database Tokay cannot rehearse. A Service can override the Project setting when one application needs a different policy.

The migration command comes from the application

Tokay detects common migration tools used by frameworks and libraries such as Rails, Django, and Prisma. When the command is uncertain, it appears in Service settings as a proposal for review. You can enter an explicit command for a setup Tokay does not detect.

A required migration can hold traffic

Some changes must complete before the new application version can run safely and cannot happen while the old version serves traffic. Tokay can place the Service in maintenance during that part of Go Live.

If the migration fails, visitors receive a clear temporary down response rather than reaching an application with a partially changed schema. Deploy a fix or choose the explicit recovery action to end the hold.

Most deployments do not show any migration decision. The extra steps appear only when the release includes a schema change or data risk.