Skip to content

v1.0.0

Choose a tag to compare

@wzrdtales wzrdtales released this 08 Oct 23:03
· 67 commits to master since this release
e3870a8

db-migrate 1.0.0

The first stable release of db-migrate 1.0, six years after the first beta. It is
the new latest on npm, 0.11 and older are end of life.

v1 migrations keep working unchanged, so for most projects upgrading means
installing 1.0 and checking the breaking changes below.

Highlights

Migration lock

Several processes migrating the same database (e.g. multiple instances
starting during a deployment) now coordinate through a lock in the state table.
Only one of them migrates, the others wait and run whatever is still pending
afterwards. A process that died while holding the lock is detected and taken
over after --lock-timeout (default 60s).

Migration schema v2

Migrations with _meta.version = 2 have no down function anymore: db-migrate
learns the schema from your instructions and reverts them on its own.

  • A failed migration is rolled back automatically, exactly the steps that
    were executed.
  • A run interrupted by a dying process is recovered on the next run, by
    skipping the steps already executed (default) or by rolling them back first
    (_meta.recovery = 'rollback'). Each skipped step is logged.

Error output

A failed migration tells you what failed: the migration, the instruction and
step for v2, the failed statement with a marker at the position reported by
the database, and the diagnostic fields of the driver like code, detail and
hint. Always with the stack, the raw error with --verbose.

[ERROR] Migration "20261009000002-users" failed at step 2 addColumn("users", "x"): type "notatype" does not exist
    SQL: ALTER TABLE "users" ADD COLUMN "x" NOTATYPE

    code: 42704

Plugins

Leaner and safer dependencies

prompt, semver, mkdirp, balanced-match and tunnel-ssh are gone, and
with them their known vulnerabilities

⚠ Breaking changes since 0.11

  • Node.js 24 and newer are suppor field is
    dropped, older versions keep installing and may work, untested.
  • SSH tunnels need the plugin: ntunnel-ssh.
    Your tunnel config stays the same.
  • Seeders are dropped. They were eed` now
    fails with a clear message instead of silently doing nothing. A new concept
    follows separately (#687).
  • transition for migrations of db-migrate before 0.9 is removed, use
    0.11 to transition such migrations
  • State table: db-migrate creates and maintains migrations_state
    (configurable with --state-table).

Drivers

Install the current driver versions tse clock for
run_on:

Driver Version
db-migrate-pg 1.6.0
db-migrate-mysql 3.1.0
db-migrate-sqlite3 1.1.0
db-migrate-cockroachdb 5.8.1

Older drivers keep working, db-migratck.

See the CHANGELOG
for every change.

What's Changed

  • Rewrite loader by @wzrdtales in #537
  • Update: Integrated Git-Start Badge
  • Use options.cwd when loading plugins by @Odame in #618
  • support custom dotenv path by @jare
  • fix: require node >= 8 by @chiawendt in #639
  • Fix(#656) Ensure scoped migration csonT in #655
  • Fix #468: avoid connecting to database before creation. by @RenWenshan in #644
  • Convert to string before splitting
  • Fix the down without specification destination. by @nicholasyih520 in #637
  • Remove pkgInfo dependency by @anshu
  • Update dependencies to fix security warnings by @rfrm in #679
  • fix(api): pass migrationName to cre #678
  • Ignore development files for npm package by @Marsup in #684
  • feat: support ESM projects. resolve724
  • Replace travis-ci with gh actions by @MasterOdin in #785
  • fix: security issues detected in pain in #781
  • fix: missing space in warning message by @mriedem in #729
  • fix(deps): remove unused semver pacs a vulnerability by @roggervalf in22
  • chore: upgrade dotenv and npm auditchore: fix typos by @noritaka1166 in #842
  • chore: replace mkdirp with native fi in #844

New Contributors

  • @360disrupt made their first contri@Odame made their first contribution in #618
  • @jaredh159 made their first contrib@chiawendt made their first contribution in #639
  • @AnsonT made their first contributi@RenWenshan made their first contribution in #644
  • @gmahe made their first contributio@nicholasyih520 made their first contribution in #637
  • @anshul07 made their first contribu@rfrm made their first contribution in #679
  • @confuser made their first contribu@Marsup made their first contribution in #684
  • @internettrans made their first con@MasterOdin made their first contribution in #785
  • @genslein made their first contribu@mriedem made their first contribution in #729
  • @roggervalf made their first contri@naseemkullah made their first contribution in #827
  • @noritaka1166 made their first cont@roli-lpci made their first contribution in #844
    Full Changelog**: v0.11.14...v1.0.0