You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thank you for your great work to provide goose as an extensible schema migration tool! In my project, I want to use goose with an unsupported database. I know that I can use a custom store as documented at https://pressly.github.io/goose/documentation/custom-store/
It would be way easier, if goose would expose a method to create a new dialect.store based on a given dialectquery.Querier, which offers a contract that is way easier to implement without duplicating store implementations.
Expand to see detailed explanations on why this is helpful + links to code
// Querier is the interface that wraps the basic methods to create a dialect specific query.
typeQuerierinterface {
// CreateTable returns the SQL query string to create the db version table.
CreateTable(tableNamestring) string
// InsertVersion returns the SQL query string to insert a new version into the db version table.
InsertVersion(tableNamestring) string
// DeleteVersion returns the SQL query string to delete a version from the db version table.
DeleteVersion(tableNamestring) string
// GetMigrationByVersion returns the SQL query string to get a single migration by version.
//
// The query should return the timestamp and is_applied columns.
GetMigrationByVersion(tableNamestring) string
// ListMigrations returns the SQL query string to list all migrations in descending order by id.
//
// The query should return the version_id and is_applied columns.
ListMigrations(tableNamestring) string
// GetLatestVersion returns the SQL query string to get the last version_id from the db version
// table. Returns a nullable int64 value.
GetLatestVersion(tableNamestring) string
}
This would drastically reduce the efforts for us, and not force us to duplicate code from dialect.go. Let me know if you'd consider something like this! I feel like the implementation would not be too difficult, basically just a new method dialect.NewStoreFromQuerier(querier dialectquery.Querier, tablename string)
The text was updated successfully, but these errors were encountered:
Hi everyone,
thank you for your great work to provide goose as an extensible schema migration tool! In my project, I want to use goose with an unsupported database. I know that I can use a custom store as documented at https://pressly.github.io/goose/documentation/custom-store/
However, with an SQL-like store, the implementation of a custom store is a bit tedious. Basically, I have to copy large chunks of https://github.com/pressly/goose/blob/main/database/dialect.go, and only exchange the sql queries used for the individual commands.
It would be way easier, if goose would expose a method to create a new
dialect.store
based on a givendialectquery.Querier
, which offers a contract that is way easier to implement without duplicating store implementations.Expand to see detailed explanations on why this is helpful + links to code
E.g.
goose/database/dialect.go
Lines 114 to 124 in 6a70e74
It would be way easier, if I could instantiate a new store as with
goose/database/dialect.go
Lines 29 to 30 in 6a70e74
But passing in something that fulfills the
Querier
interfacegoose/internal/dialect/dialectquery/dialectquery.go
Lines 5 to 29 in 6a70e74
This would drastically reduce the efforts for us, and not force us to duplicate code from
dialect.go
. Let me know if you'd consider something like this! I feel like the implementation would not be too difficult, basically just a new methoddialect.NewStoreFromQuerier(querier dialectquery.Querier, tablename string)
The text was updated successfully, but these errors were encountered: