-
-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI command to generate a new migration (#656)
* feat(cli): add 'migration generate' subcommand This subcommend will create a new, empty migration. * feat(deps): add chrono crate This crate will allow me to fetch the current date and time required for generating the migration filename. * feat(cli): generate migration filename * feat(cli): read template, replace migration name * feat(cli): write modified content to file * feat(deps): add regex crate Allows me to parse the lib.rs file containing the migrator logic. * fix(cli): add missing chrono import * feat(cli): mod declaration for new migration This modifies the existing migator file, adding a module declaration for the newly generated migration. * feat(cli): regenerate migration vector * feat(cli): write updated migrator file to disk This completes updating the migrator file with the new migration information. * docs(cli): additional docstring * refactor(cli): move logic into functions * test(cli): create new migration happy path * test(cli): update migrator happy path * fix(cli): dedicated tmp dir for test This avoids conflicts with the other tests. * style(cli): align generated code with cargofmt As suggested by @billy1624 in the review of #656. * feat(cli): harden regex against extra spaces As suggested by @billy1624 in the review of #656. Co-authored-by: Billy Chan <[email protected]>
- Loading branch information
1 parent
b8214b2
commit 3518acf
Showing
3 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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