migrator

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 8 Imported by: 0

README

migrator

Extends golang-migrate to support create database, currently only for postgres.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migrator

type Migrator interface {
	CreateDb() error
	Up() (err error)
	Down() (err error)
	Migrate(version uint) (err error)
}

func NewPostgres

func NewPostgres(migrations embed.FS,
	migrationsPath,
	dbConnectionString,
	createSecurityFile,
	createSchemaFile string,
	createDb bool,
	logger logger.Logger) (Migrator, error)

NewPostgres returns an instance of migrator

type PostgresMigrator

type PostgresMigrator struct {
	// contains filtered or unexported fields
}

func (*PostgresMigrator) CreateDb

func (m *PostgresMigrator) CreateDb() error

CreateDb attempts to create the database if it does not exists

func (*PostgresMigrator) Down

func (m *PostgresMigrator) Down() (err error)

Down migrates all the way down

func (*PostgresMigrator) Migrate

func (m *PostgresMigrator) Migrate(version uint) (err error)

Migrate to a specific version either up or down

func (*PostgresMigrator) Up

func (m *PostgresMigrator) Up() (err error)

Up migrates all the way up, usually go for local environments

Jump to

Keyboard shortcuts

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