-
Notifications
You must be signed in to change notification settings - Fork 516
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
Add goose provider with unimplemented methods #596
Conversation
provider.go
Outdated
// If opts is nil, the default options are used. See ProviderOptions for more information. | ||
// | ||
// Unless otherwise specified, all methods on Provider are safe for concurrent use. | ||
func NewProvider(dialect Dialect, db *sql.DB, opts *ProviderOptions) (*Provider, 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.
@VojtechVitek wdyt about adding the Provider to the /v3 module instead of cutting an entire new major version /v4.
This was the plan for #507, but after a lot of thought, I think we can iterate on the Provider and extend it to support a bunch of features folks have been asking for.
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.
sounds like a good idea :)
7be1a0c
to
62e1b6a
Compare
2a82cbe
to
32114dc
Compare
ac8c81d
to
0355c61
Compare
// meant to be exhaustive or test every possible database dialect. It is meant to verify the Store | ||
// interface works against a real database. | ||
|
||
func TestStore(t *testing.T) { |
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.
This allows us to test the Store implementation in isolation from migrations.
┌───────────────────────────────────────────────────────────────────────────────────────────────────┐
│ STATUS │ ELAPSED │ PACKAGE │ COVER │ PASS │ FAIL │ SKIP │
│─────────┼─────────┼─────────────────────────────────────────────────┼───────┼──────┼──────┼───────│
│ PASS │ 1.94s │ github.com/pressly/goose/v3/internal/sqladapter │ 70.8% │ 3 │ 0 │ 0 │
└───────────────────────────────────────────────────────────────────────────────────────────────────┘
There's both a short (sqlite3 with a temp test directory) and long (postgres container) test
// Functional options are used to configure the Provider. See [ProviderOption] for more information. | ||
// | ||
// Unless otherwise specified, all methods on Provider are safe for concurrent use. | ||
func NewProvider(dialect Dialect, db *sql.DB, fsys fs.FS, opts ...ProviderOption) (*Provider, 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.
I'm fairly happy with the ergonomics of this API.
This PR stubs out a
Provider
in the current /v3 module. It takes the ideas and best parts from #507 and attempts to bring them into the current module in a backwards-compatible way.I may have been wrong, and cutting a /v4 was probably not the best approach. We can leave the /v4 as a future iteration based on feedback and one last (famous last words) cleanup of the package.
There will be notable differences between the
Provider
methods and the existing*Migration
methods / direct functions, for example: