Add tern migrate command with up/down subcommands#66
Merged
Conversation
FEATURE: Add tern migrate up/down commands with tern up/down as aliases Implements the migrate command with two subcommands: - migrate up: Run pending migrations (same as existing up) - migrate down: Revert the most recently applied migration The down command computes inverse operations for reversible migrations and removes the migration record from the database tracking tables. Irreversible operations (like DropTable) will error with a clear message. tern up and tern down are now aliases for tern migrate up/down for convenience.
FEATURE: Store inverse operations in migration files for offline reversal This changes down migrations from being computed on-the-fly at runtime to being computed and persisted when migrations are generated. Key changes: - Rename Migration.operations to up_operations - Add Migration.down_operations field for pre-computed inverse operations - Add src/db/migrate/inverse.rs module for computing inverse operations - Update all migration generation paths (generate, import, init) to compute and store down_operations - Simplify down command to use pre-computed operations - Add is_reversible() method to Migration Breaking change: Migration JSON format now uses up_operations/down_operations instead of operations field.
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.
FEATURE: Add tern migrate up/down commands with tern up/down as aliases
Implements the migrate command with two subcommands:
The down command computes inverse operations for reversible migrations
and removes the migration record from the database tracking tables.
Irreversible operations (like DropTable) will error with a clear message.
tern up and tern down are now aliases for tern migrate up/down
for convenience.