Documentation ¶
Overview ¶
Package migration contains functions for generating and finding PostgreSQL database migrations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RunStatus ¶
type RunStatus int
RunStatus is a type that indicates if a migration has been run, not run, or if we can't determine the status.
type WalkFunc ¶
WalkFunc is the type of the function called for each file or directory visited by a Walker.
type Walker ¶ added in v0.0.2
Walker is a function that can be used to walk a filesystem and calls WalkFunc for each migration.
func NewWalker ¶ added in v0.0.2
NewWalker queries the database for migration status information and returns a function that walks the migrations it finds on the filesystem in lexical order (mostly, keep reading) and calls a function for each discovered migration, passing in its name, status, and file information.
If a migration exists in the database but not on the filesystem, info will be nil and f will be called for it after the migrations that exist on the filesystem. No particular order is guaranteed for calls to f for migrations that do not exist on the filesystem.
If NewWalker returns an error and a non-nil function, the function may still be used to walk the migrations on the filesystem but the status information may be wrong since the DB may not have been queried successfully.