Documentation ¶
Index ¶
Constants ¶
View Source
const ( PathFieldName = "migrator.source" DriverReplacement = "${db.driver}" PathDefault = "file://./migrations/" + DriverReplacement )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ table.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewConfig, NewWithConfigurator, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Path, PathFieldName, PathDefault, "path to migrations directory") }) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( migrator *migrate.Migrate, informer logger.Informer, ) error { err := migrator.Up() if err != nil && err != migrate.ErrNoChange { return err } if err == migrate.ErrNoChange { return nil } version, _, err := migrator.Version() informer.Infof("migrator: up to '%d' version", version) return nil }) }), }
Functions ¶
func NewWithConfigurator ¶
func NewWithConfigurator( config *Config, configurator configurator.Configurator, db client.DataBase, informer logger.Informer, tableReplacer table.Replacer, ) (*migrate.Migrate, error)
Types ¶
type Config ¶
type Config struct {
Path string
}
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
Click to show internal directories.
Click to hide internal directories.