-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd: migrate command #18
Conversation
cmd/migrate.go
Outdated
PersistentPreRun: func(_ *cobra.Command, _ []string) { | ||
cfgOpts.Require() | ||
if err := cfgOpts.SetValues(); err != nil { | ||
log.Fatalf("Error setting values of config options: %s", err.Error()) | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before you write too many CLI commands, there's a good practice you should adopt here.
These commands have counterparts that return errors:
PersistentPreRun
->PersistentPreRunE
Run
->RunE
- ...
Instead of logging with Fatal, it's better to return an error and log + Panic in the root caller. It's easier to debug and to write tests for it.
log.Fatalf
calls os.Exit(0), which terminates the program without very good feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising this @marcelosalloum! Great suggestion.
I'll add to this one and refactor the other two commands we already have in place. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for this command! 🚀
@@ -24,3 +24,8 @@ func Open(t *testing.T) *dbtest.DB { | |||
|
|||
return db | |||
} | |||
|
|||
func OpenWithoutMigrations(t *testing.T) *dbtest.DB { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
What Adds the Dockerfile for building the API's Docker image. A Makefile is also added to make the CI/CD later easier. The docker-compose is also changed to use the new Dockerfile and run the API more easily. Why Building the system's Docker image.
…nto migrate-command
What
Adds the
migrate up/down
command.Why
For applying the database migration. This is a required component for the CI/CD setup.
Known limitations
N/A
Issue that this PR addresses
[Wallet Backend] Implement migrate command
Checklist
PR Structure
all
if the changes are broad or impact many packages.Thoroughness
Release