Skip to content

Migration Commands

The migrate group is the versioned SQL workflow.

nautilus migrate generate

Create a new migration file from the current schema diff.

text
Usage: nautilus migrate generate [OPTIONS] [LABEL]
OptionMeaning
[LABEL]Human-readable label such as add_users
-s, --schema <SCHEMA>Schema path
--database-url <DATABASE_URL>Database URL override
--migrations-dir <MIGRATIONS_DIR>Migration directory override

nautilus migrate apply

Apply all pending migration files in chronological order.

text
Usage: nautilus migrate apply [OPTIONS]
OptionMeaning
-s, --schema <SCHEMA>Schema path
--database-url <DATABASE_URL>Database URL override
--migrations-dir <MIGRATIONS_DIR>Migration directory override

nautilus migrate rollback

Roll back the last applied migration set.

text
Usage: nautilus migrate rollback [OPTIONS]
OptionMeaning
--steps <STEPS>Number of migrations to roll back, default 1
-s, --schema <SCHEMA>Schema path
--database-url <DATABASE_URL>Database URL override
--migrations-dir <MIGRATIONS_DIR>Migration directory override

nautilus migrate status

Show pending and applied migration state.

text
Usage: nautilus migrate status [OPTIONS]
OptionMeaning
-s, --schema <SCHEMA>Schema path
--database-url <DATABASE_URL>Database URL override
--migrations-dir <MIGRATIONS_DIR>Migration directory override

Use this group when:

  • you want committed SQL files
  • reviewers should see the exact DDL
  • rollback files matter
  • environments must advance through the same ordered changes

Based on the upstream Nautilus project by nautilus-env.