CLI command to generate a new migration#656
Merged
tyt2y3 merged 18 commits intoSeaQL:masterfrom May 9, 2022
viktorbahr:master
Merged
CLI command to generate a new migration#656tyt2y3 merged 18 commits intoSeaQL:masterfrom viktorbahr:master
tyt2y3 merged 18 commits intoSeaQL:masterfrom
viktorbahr:master
Conversation
This subcommend will create a new, empty migration.
This crate will allow me to fetch the current date and time required for generating the migration filename.
Allows me to parse the lib.rs file containing the migrator logic.
This modifies the existing migator file, adding a module declaration for the newly generated migration.
This completes updating the migrator file with the new migration information.
This avoids conflicts with the other tests.
Member
|
Thanks a lot. It definitely looks promising |
Member
|
@billy1624 thoughts? |
billy1624
requested changes
Apr 22, 2022
Member
billy1624
left a comment
There was a problem hiding this comment.
Hey @viktorbahr, sorry for the delay! Thank you for the contributions!
Contributor
Author
No worries @billy1624 🖖 - thanks for your feedback. |
As suggested by @billy1624 in the review of #656.
As suggested by @billy1624 in the review of #656.
Contributor
Author
|
Two good points, included the changes suggested by you, please re-review @billy1624 . |
billy1624
added a commit
to SeaQL/seaql.github.io
that referenced
this pull request
Jul 13, 2022
tyt2y3
added a commit
to SeaQL/seaql.github.io
that referenced
this pull request
Jul 17, 2022
* Custom join condition (SeaQL/sea-orm#793) * Migration does not depend on entity crate * Define integer enum with repr[x] syntax * Document datatype mappings (SeaQL/sea-orm#772) * Cursor pagination (SeaQL/sea-orm#754, SeaQL/sea-orm#822) * (de)serialize custom JSON types (SeaQL/sea-orm#794) * Generate new migration file (SeaQL/sea-orm#656) * Skip generating entity file for specific tables (SeaQL/sea-orm#837) * Generate entity with date time crate option (SeaQL/sea-orm#724) * Drop `SelectTwoMany::one()` method (SeaQL/sea-orm#813) * Datatype mappings of primitives (SeaQL/sea-orm#850, SeaQL/sea-schema#75) * Join with table alias (SeaQL/sea-orm#852) * SQLx logging level (SeaQL/sea-orm#800) * Insert with on conflict (SeaQL/sea-orm#791) * Migrate generate should take file name as argument instead of option (SeaQL/sea-orm#870) * Upgrade docusaurus to 2.0.0-beta.22 * What's new in SeaORM 0.9.0 * Move migration section forward * Rename "Generating Database Schema" section to "Generating SeaQuery Statement" * Fix broken links * Edit * Edit * Edit * Edit Co-authored-by: Chris Tsang <[email protected]>
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.
Adds
This PR adds a new subcommand to the SeaORM CLI that lets user create a new migration. This simplifies the migration process, new migrations no longer need to be added manually.
Example Usage:
sea migrate generate namemYYYYMMDD_HHMMSS_name)sea-orm/sea-orm-cli/template/migration/m20220101_000001_create_table.rsMIGRATION_DIRargument, similar to the othersea migratesubcommandsMIGRATION_DIR/src/lib.rs) to include the new migrationChanges
command.rschronocrate for timestamp generationregexcrate for extracting information from the migrator filePossible Improvements
The following aspects of this PR could IMO be improved:
Run sea migration init first..)