talos migration:up. The command runs each module’s bin/migration/up.ts script from the module’s own directory. Each runner loads every registered migration, sorts it by version, applies each pending one inside a transaction, and records the version when it succeeds.
| Option | Description | Default |
|---|---|---|
--drop | Drop and recreate the public schema before running migrations. | false |
--no-cache | Skip reading and writing the migration cache. | false |
How a run proceeds
The runner creates the tracking table if it is missing, then walks every migration in version order. For each one it checks the tracking table for the version’sid; if the row exists, the migration is already applied and is skipped. Otherwise it opens a transaction, runs the migration’s dependencies and then its up(), and inserts the version’s id into the tracking table. Because the insert is part of the same transaction, a failure rolls back both the schema change and the tracking row, and the run stops.
Dropping the schema
Passing--drop runs DROP SCHEMA public CASCADE followed by CREATE SCHEMA public before any migration runs, then re-applies every migration from scratch. That is destructive — it wipes the whole schema — so reserve it for development and never point it at a shared or production database. --drop also bypasses the cache, since the reset must always re-run.
Running up() directly
Outside the CLI you can call up() from @talosjs/migrations. It reads DATABASE_URL and uses the default migrations table by default, or takes an explicit connection string and tracking table name:
migration:up command for the full reference.
Next steps
- Rolling back: reverse an applied migration with
talos migration:down. - Caching: how the per-version run cache skips unchanged migrations.