Skip to content

init

Create the migration tracking schema (3 tables) on the target database.

Database required: Yes

Usage

bash
dbsh init --connection-string "Host=localhost;Database=myapp;Username=postgres;Password=secret"

Tables created

TablePurpose
__migration_historyOne row per applied migration per environment
__migration_lockDistributed lock preventing concurrent deploys
__migration_auditAppend-only audit trail

The DDL is idempotent — if the tables already exist, init won't modify them.

When to run

Run dbsh init once per database, before your first dbsh migrate. You don't need to run it again afterward.

Notes

  • The schema name comes from tracking.schema in migration.json (default: public)
  • Table names come from tracking.tableName (default: __migration_history)
  • DDL is engine-specific: UUID, boolean, and timestamp types differ between PostgreSQL, SQL Server, MySQL, and SQLite

Released under the MIT License.