migrate

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Datasources     map[string]Datasource `json:"datasources"`
	MigrationsDir   string                `json:"migrations"`
	MigrationsTable string                `json:"migrations_table"`
}

Config for migrate module

type Datasource

type Datasource struct {
	Driver string `json:"driver"`
	DSN    string `json:"dsn"`
}

Datasource is parsed from the config

func (*Datasource) Connect

func (d *Datasource) Connect() (*sql.DB, error)

Connect is a helper function to connect to this datasource

type Module

type Module struct {
	Config *config.Module
	DB     *sql.DB
	Logger *logger.Module
	// contains filtered or unexported fields
}

Module migrate provides support for migrating postgres databases using rubenv/sql-migrate

func (*Module) ConnectDefault

func (m *Module) ConnectDefault() (*sql.DB, error)

ConnectDefault to the DB with name specified by env

func (*Module) GetBackend

func (m *Module) GetBackend(dbname string) (backend, error)

GetBackend selects the datasource identified by dbname in the config file and initializes the correct type of backend.

func (*Module) Init

func (m *Module) Init(c *service.Config)

Init the migrate module

func (*Module) SetBackOff

func (m *Module) SetBackOff(b backoff.BackOff)

func (*Module) SetMigrationFS added in v1.5.4

func (m *Module) SetMigrationFS(f fs.FS)

SetMigrationSource sets the migration source, for compatibility with embedded file assets.

func (*Module) SetMigrationSource

func (m *Module) SetMigrationSource(asset assetFunc, assetDir assetDirFunc, dir string)

SetMigrationSource sets the migration source, for compatibility with embedded file assets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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