-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
backwards incompatibleChange is backwards incompatibleChange is backwards incompatiblehelp wantedExtra attention is neededExtra attention is needed
Description
Goals:
- Configurable timeouts
- Granularity of configuration? e.g. different timeouts for different operations
- No possibility of dangling locks. See: postgres driver should wait for lock #13 (comment)
Possible Goals:
- Composability
- Allow drivers to be composed of another driver(s)
- maybe expose a methods for getting:
- the db connection (
*sql.Conn
or*sql.DB
or some interface) - for overwriting migration management queries - the config - for shared config
- the db connection (
- maybe expose a methods for getting:
- Allow drivers to be composed of another driver(s)
- Safety
- Struct fields should not be exported unnecessarily. e.g many DB driver
Config
structs have all of their fields exported. This is dangerous since the DB driver has a pointer to theConfig
, whose exported field values may be changed inadvertently. Another option would be to keep a copy of theConfig
struct in the DB driver, but if any of theConfig
struct fields are pointers, we have the same problem...- Add
NewConfig()
method for creating configs with unexported struct fields. - Unexported
Config
struct fields may make sharing config between composed/dependent drivers harder
- Add
- Struct fields should not be exported unnecessarily. e.g many DB driver
Ideas:
- Require
context.Context
as the first param forDriver
receiver functions- Which receiver functions should require context?
- How does a context timeout/cancel affect the DB state? Is it consistent across all DBs?
- Which DBs support
context.Context
? - Will break DB drivers not explicitly maintained by this repo
- Add retry with timeout helper for DBs that don't support acquiring a lock within a timeout
- Make the
Open
method on theDriver
interface take aurl.URL
struct instead of astring
- See: prevent net/url encoding the user password #69
- Prevents double parsing of the url string
- Run each migration in a transaction managed by migrate. See: Enhancement: Wrap each migration file in an atomic transaction #196
- Safely support RDBMSs that don't support transactional DDL
- Add
EnsureVersionTable()
method - Add a
Metadata()
method - Remove
Drop()
method - Create DB
- See: Cant seem to create a database from migration when it doesnt exist #347
- Would require migrating migration storage to it's own DB in a DBMS and tracking the migration status for a DB. e.g. the schema migration table would need to track the latest migration, the db, and if it's dirty
- To be backwards compatible, we'd need to support migrations for the schema migration table
- Use
migrate
to manage version and metadata table schemas - Return concrete types in DB driver implementation with compile time type checks
dbolotin, asterikx, Azuka, sfllaw and zydxhs
Metadata
Metadata
Assignees
Labels
backwards incompatibleChange is backwards incompatibleChange is backwards incompatiblehelp wantedExtra attention is neededExtra attention is needed