Skip to content
ReferenceCommand line

rent migrate apply

rent migrate apply validates rent/migrations/rent.sum, loads every SQL file in version order, skips files already recorded with the same checksum, and applies each pending file. It never recalculates a schema diff during deployment.

Migration artifacts may be mounted read-only. Application and checksum failures still make the command fail. A successful application is not reported as failed merely because optional local expression metadata cannot be refreshed afterward. That condition prints a warning and preserves the successful exit status.

When the RSL schema is available, the command can refresh rent.generated.json, which records how the database normalizes generated expressions and partial-index predicates. Unchanged metadata is not rewritten. Author and review migrations with rent migrate dev in a writable checkout, and ship that metadata with the SQL and rent.sum when using expression-aware drift checks. A deployment that ships only reviewed migrations does not need the RSL schema or a writable source tree.

Apply pending migrations

rent migrate apply
Applied 20260910022456_create_users (2 statements)
Applied 20260910022512_add_posts (1 statement)

Running it again is idempotent:

Ready: No pending migrations.

Use another migration directory

rent migrate apply --directory database/migrations
Applied 20260910022456_create_users (4 statements)

Approve reviewed destructive SQL

rent migrate apply --allow-destructive
Applied 20260910022703_remove_legacy_sessions (1 statement)

Without --allow-destructive, Rent rejects files containing destructive operations such as DROP TABLE, TRUNCATE, DROP COLUMN, or DROP CONSTRAINT.

Recovery-only switches

rent migrate apply --no-transaction --no-lock

--no-transaction and --no-lock remove normal safety guarantees. Reserve them for operations that cannot run transactionally or for an externally serialized maintenance window.