Simple migration capabilities for any Go backend

Aneurin Barker Snook 2ff5372bfd replace go-version 10 tháng trước cách đây
.github c3687e17e0 add test workflow 10 tháng trước cách đây
.gitignore 97bce22b38 initial working version 10 tháng trước cách đây
LICENSE.md ef8ff4b25d add readme 10 tháng trước cách đây
README.md 2ff5372bfd replace go-version 10 tháng trước cách đây
error.go 2ff5372bfd replace go-version 10 tháng trước cách đây
func_migration.go ef8ff4b25d add readme 10 tháng trước cách đây
go.mod 2ff5372bfd replace go-version 10 tháng trước cách đây
interfaces.go 97bce22b38 initial working version 10 tháng trước cách đây
module.go 2ff5372bfd replace go-version 10 tháng trước cách đây
module_test.go 2ff5372bfd replace go-version 10 tháng trước cách đây

README.md

Migres

This package provides simple migration capabilities for any backend.

System requirements

Basic usage

The key type in this package is Module which allows mapping version strings to Migration interfaces. For example:

import "github.com/annybs/migres"

type MyBackend struct{}

func (mb *MyBackend) Module() migres.Module {
  return migres.Module{
    "1.0.0": migres.Func(mb.upgradeV1, mb.downgradeV1),
    "2.0.0": migres.Func(mb.upgradeV2, mb.downgradeV2),
  }
}

Call Module.Upgrade(from, to) or Module.Downgrade(from, to) in order to execute migrations. The module ensures migrations are all run in the correct order.

License

See LICENSE.md