migration

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

flam-database-migration

flam-database-migration is a flam-in-go extension to provide database migrations functionalities

Documentation

Index

Constants

View Source
const (
	LoggerCreatorGroup    = "flam.database_migration.loggers.creator"
	LoggerDriverDefault   = "flam.database_migration.loggers.driver.default"
	MigratorCreatorGroup  = "flam.database_migration.migrators.creator"
	MigratorDriverDefault = "flam.database_migration.migrators.driver.default"
	MigrationGroup        = "flam.database_migration.migrations"

	PathDefaultConnection    = "flam.database_migration.defaults.connection"
	PathDefaultLogger        = "flam.database_migration.defaults.logger"
	PathDefaultLogChannel    = "flam.database_migration.defaults.log.channel"
	PathDefaultLogStartLevel = "flam.database_migration.defaults.log.start.level"
	PathDefaultLogErrorLevel = "flam.database_migration.defaults.log.error.level"
	PathDefaultLogDoneLevel  = "flam.database_migration.defaults.log.done.level"
	PathBoot                 = "flam.database_migration.boot"
	PathLoggers              = "flam.database_migration.loggers"
	PathMigrators            = "flam.database_migration.migrators"
)

Variables

View Source
var (
	DefaultConnection    = ""
	DefaultLogger        = ""
	DefaultLogChannel    = "flam"
	DefaultLogStartLevel = log.Info
	DefaultLogErrorLevel = log.Error
	DefaultLogDoneLevel  = log.Info
)
View Source
var (
	ErrMigrationNotFound = errors.New("migration not found")
)

Functions

func NewProvider

func NewProvider() flam.Provider

Types

type Facade

type Facade interface {
	HasLogger(id string) bool
	ListLoggers() []string
	GetLogger(id string) (Logger, error)
	AddLogger(id string, logger Logger) error

	HasMigrator(id string) bool
	ListMigrators() []string
	GetMigrator(id string) (Migrator, error)
	AddMigrator(id string, migrator Migrator) error
}

type Info

type Info struct {
	Version     string
	Description string
	InstalledAt *time.Time
}

type Logger

type Logger interface {
	LogUpStart(migration Info) error
	LogUpError(migration Info, e error) error
	LogUpDone(migration Info) error

	LogDownStart(migration Info) error
	LogDownError(migration Info, e error) error
	LogDownDone(migration Info) error
}

type LoggerCreator

type LoggerCreator interface {
	Accept(config flam.Bag) bool
	Create(config flam.Bag) (Logger, error)
}

type Migration

type Migration interface {
	Group() string
	Version() string
	Description() string
	Up(connection database.Connection) error
	Down(connection database.Connection) error
}

type Migrator

type Migrator interface {
	List() ([]Info, error)
	Current() (*Info, error)
	CanUp() bool
	CanDown() bool
	Up() error
	UpAll() error
	Down() error
	DownAll() error
}

type MigratorCreator

type MigratorCreator interface {
	Accept(config flam.Bag) bool
	Create(config flam.Bag) (Migrator, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址