bookkeeping schema, migration ordering, and 1.0 API changes - #34
Merged
Merged
Conversation
…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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking changes ahead of the 1.0 release.
Bookkeeping and migrations
id,checksum, andapplied_atcolumns to__migrant_migrations; record a sha256 of each migration's up SQL (NoneforFnMigration) and revert the last-applied migration by recorded order onDownMigrator::allow_unknown_tags/allow_out_of_orderand the CLI--allow-unknown-tags/--allow-out-of-orderflags onapplyandredo(stamp, tag)for a deterministic total order, so same-second migrations no longer resolve nondeterministicallyCLI
migrant apply; add--step Nfor a bounded run and remove--allfromapply(redokeeps it).--downstays single-step by defaultmigrant newLibrary API
migrant_lib::newtocreate_migrationreturningNewMigration; movelisttomigrant_lib::cli::listdatabase_path/migration_locationinfallible (validation deferred tobuild()), and reject non-UTF-8 paths ininitto matchDirectionby value inMigratable::descriptionandcli::edit; sealMigratableClone; addMigratable::checksumsha2dependencyUpgrade
The
__migrant_migrationsschema change is a breaking on-disk change. See CHANGELOG.md for the table upgrade, or re-create the table.Tests
tests/sqlite.rs, andtests/migrant.rsgreen;cargo clippy --all-targetsandcargo fmt --all --checkcleanbash migrant_lib/test.sh(throwaway docker), including the__migrant_migrationsschema assertions (checksum recorded,applied_atnot null,order by id)