-
Notifications
You must be signed in to change notification settings - Fork 92
Dont require database access to pgroll latest --local
#760
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
Conversation
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.
Pull Request Overview
This pull request decouples database access from the local "latest" command by converting LatestVersionLocal into a standalone function that operates only on local migration files.
- Removed the receiver from LatestVersionLocal and updated its usage in tests.
- Updated the latest command implementation to use separate helper functions for local and remote version retrieval.
- Adjusted error messages in the command for clearer context.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/roll/latest_test.go | Updated tests to use the new standalone LatestVersionLocal |
pkg/roll/latest.go | Converted LatestVersionLocal from a method to a function |
cmd/latest.go | Refactored command logic to handle local and remote modes |
Comments suppressed due to low confidence (1)
cmd/latest.go:60
- Consider wrapping the error returned by os.Stat with additional context (e.g., "failed to stat directory") to improve clarity compared to the previous version.
return "", err
27badf0
to
670a27d
Compare
rebased to resolve a merge conflict |
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.
Smallest nit of my life
`LatestVersionLocal` is a function that doesn't need to be a method of the `Roll` type. It can be a package-level function instead.
Ensure that the `latest` command does not require database access when the `--local` flag is provided. In this case the command should act locally, with the migrations on disk and not require a connection to the database.
670a27d
to
4f7373a
Compare
Ensure that the
latest
command does not require database access when the--local
flag is provided.In this case the command should act only locally, with the migrations on disk and not require a connection to the database.
The reason it used to require a DB connection was to support the
--with-schema
flag which took the schema name from an instantiatedRoll
instance. Change this so that the schema name is instead taken from the command line--schema
flag (or thePGROLL_SCHEMA
env var) directly instead.Fixes #726