migrate
migrate copied to clipboard
Structured Logging
Logging output is unstructured at the moment. It would be nice to make logging a bit more sophisticated and have drivers return structured logs.
v1 tried to make this happen by allowing drivers to return a bunch of types sent over a channel, like text, error, *Migration Struct. That was a poor design choice.
Ideally we introduce an error struct with common fields. This error struct could then always be extended by the driver.
A first idea for a database error struct:
type DatabaseErr struct {
Version int
Identifier string
Direction Direction
Line uint
Error string
SuggestedFix string
OrigError error
}
package database now has an Error struct. https://github.com/mattes/migrate/blob/master/database/error.go
It can be further wrapped by package migrate down the road to extend it with more fields like:
Identifier string
Direction Direction