Skip to content

bookkeeping schema, migration ordering, and 1.0 API changes - #34

Merged
jaemk merged 3 commits into
mainfrom
260804.pre-1.0-breaking-changes
Aug 15, 2026
Merged

jaemk merged 3 commits into
mainfrom
260804.pre-1.0-breaking-changes

Conversation

@jaemk

@jaemk jaemk commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Breaking changes ahead of the 1.0 release.

Bookkeeping and migrations

  • add id, checksum, and applied_at columns to __migrant_migrations; record a sha256 of each migration's up SQL (None for FnMigration) and revert the last-applied migration by recorded order on Down
  • error on an applied tag missing from the defined set or an out-of-order apply; opt out with Migrator::allow_unknown_tags / allow_out_of_order and the CLI --allow-unknown-tags / --allow-out-of-order flags on apply and redo
  • sort discovered migrations by (stamp, tag) for a deterministic total order, so same-second migrations no longer resolve nondeterministically

CLI

  • apply all pending migrations on migrant apply; add --step N for a bounded run and remove --all from apply (redo keeps it). --down stays single-step by default
  • print the created file paths from migrant new

Library API

  • rename migrant_lib::new to create_migration returning NewMigration; move list to migrant_lib::cli::list
  • make settings-builder database_path / migration_location infallible (validation deferred to build()), and reject non-UTF-8 paths in init to match
  • take Direction by value in Migratable::description and cli::edit; seal MigratableClone; add Migratable::checksum
  • add the sha2 dependency

Upgrade

The __migrant_migrations schema change is a breaking on-disk change. See CHANGELOG.md for the table upgrade, or re-create the table.

Tests

  • library unit, tests/sqlite.rs, and tests/migrant.rs green; cargo clippy --all-targets and cargo fmt --all --check clean
  • postgres and mysql verified via bash migrant_lib/test.sh (throwaway docker), including the __migrant_migrations schema assertions (checksum recorded, applied_at not null, order by id)

jaemk added 3 commits August 4, 2026 08:47
…ngs and migrator API

- add `id`, `checksum`, and `applied_at` columns to `__migrant_migrations`; record a
  sha256 of each migration's up SQL (`None` for `FnMigration`) via `Migratable::checksum`,
  and revert the last-applied migration by recorded order on `Down`
- error on an applied tag missing from the defined set or an out-of-order apply; add
  `Migrator::allow_unknown_tags` and `allow_out_of_order` to opt out
- sort discovered migrations by `(stamp, tag)` for a deterministic total order, so
  same-second migrations no longer resolve nondeterministically
- make `SqliteSettingsBuilder`/`ServerSettingsBuilder` `database_path` and
  `migration_location` infallible, deferring path validation to `build()`, and reject
  non-UTF-8 paths in `init`
- rename `migrant_lib::new` to `create_migration` returning `NewMigration`; move `list`
  to `migrant_lib::cli::list`
- take `Direction` by value in `Migratable::description` and `cli::edit`; seal
  `MigratableClone`
- add the `sha2` dependency

The `__migrant_migrations` schema change is a breaking on-disk change; existing databases
need the table upgrade noted in CHANGELOG.md.
…t-out flags

- apply all pending migrations on `migrant apply`; add `--step N` for a bounded run and
  remove `--all` from `apply` (`redo` keeps it). `--down` stays single-step by default
- add `--allow-unknown-tags` and `--allow-out-of-order` to `apply` and `redo`
- call `create_migration` and print the created file paths; use `migrant_lib::cli::list`
@jaemk
jaemk merged commit 9b61edf into main Aug 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant