Skip to content

v2.0.0: Merge pull request #7 from getkalido/feature/rework

Latest
Compare
Choose a tag to compare
@rjacobs31 rjacobs31 released this 23 Oct 11:42
· 10 commits to master since this release
24af310

This migration library was in dire need of an update, to make it easier to maintain and use.

Changelog

  • Functionality has been encapsulated, so that migrations can be managed for multiple databases without trampling each other's configuration.
  • Migrations now need to be registered in a Registry object.
    • This does mean that the pattern of globally registering migrations in init() methods no longer work. The workaround is to define a Registry (by value, not pointer) in the package where migrations are generated. The zero-value of the registry is ready for use, so it doesn't need special initialisation.
    • The Registry should be thread-safe.
  • Functionality is now accessed by running methods on a Migrator. This should be easier to use than emulating command-line arguments without proper type-checking.
  • Case conversion now allocates fewer strings.
  • Configuration is achieved by the options pattern. Any of the With*() functions can be called and passed to the Migrator's constructor as additional arguments.
  • The package now defines a number of errors, which can be easily checked with errors.Is() from github.com/pkg/errors.