Open mjovanc opened 1 year ago
Command/args logic now in place and skeleton functions added that will be updated later.
Basic command line functionality in place, now its just time to actually implement generate, run and rollback functions.
How should we specify which connector we should use, for example:
njord migration generate <name> --env=development --dry-run --connector=sqlite
or during installation of the CLI with:
cargo install njord --no-default-features --features sqlite
By using:
njord setup
We should look for a file usually located in src/schema.rs if not specified elsewhere in njord.toml
file to extract values from there and create SQL queries based on that. Not like Diesel does that you have to manually create the SQL queries to setup tables...
Passing in --env=development
doesn't get the actual value as well as other arguments:
Migration files generated successfully:
Version: 00000000000002
Name: --name=update_users
Environment: Some("--")
Dry-run: None
This looks like something right up my alley 😁
@newtoallofthis123 Super! Would you have time to look at my previous comment with that issue with passing arguments? That would be very helpful since I do not have time at the moment to look at it. If you do, just fork the repo, send a PR. Thanks!
Sure will
Hey! Your code seems quite good and it is working just fine for me...
My suspicion is that it might be a weird thing with your terminal....can you once try using '--env=development' or --env='development'
Alright, I can not test right now, but could you look maybe into how we can strip the --env=
from the arg strings here: https://github.com/njord-rs/njord/blob/master/njord_cli/src/command.rs#L139
So we can pass only the "pure" values into the next function to call, either generate()
, run()
and rollback()
?
So, strip the string and have an enum? or something like that?
So, strip the string and have an enum? or something like that?
Sounds good to me!
The CLI has been improved with functionality of generating new schema changes and running it. However a lot of work still persists and help here is needed! Will pause this CLI tool since it's not really necessary at the moment. More important work is needed on njord
and njord_derive
crate.
Let me know if someone is interested in helping out here.
I just forked the repo and will try to read through it to understand the code. Happy to continue work on this as soon I'm done
Commands that should exist:
Flags that should exist on
njord
:-v
and--version
-h
and--help
Flags that should exist on
njord migration
:--dry-run
(simulate the migration)--env
(specify development/test/staging/production etc)--dir
(specify target directory for generated migration changes)--to
(rollback to specific version, for example20191225120000
)--log-level
(standard, debug etc)Examples: