pms

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

pms

Postgres Migration System

Documentation

Index

Constants

View Source
const (
	TABLE_NAME         = "migrations"
	QUERY_CREATE_TABLE = `CREATE TABLE %s (
		version VARCHAR(255) NOT NULL DEFAULT 0
	);
	INSERT INTO migrations (version) VALUES (0);`
	QUERY_UPDATE_VERSION = "UPDATE %s SET version=%d"
	ERROR_EQUAL_VERSION  = "current version %d equals current"
)
View Source
const (
	SELECT_VERSION = "SELECT version FROM migrations"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction string
const (
	DIRECTION_UP   Direction = "up"
	DIRECTION_DOWN Direction = "down"
)

type Migration

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

func (*Migration) Down

func (m *Migration) Down() error

func (*Migration) Up

func (m *Migration) Up() error

func (*Migration) Version

func (m *Migration) Version(version int) error

type Migrator

type Migrator interface {
	Up() error
	Down() error
	Version(int) error
}

func New

func New(db *sqlx.DB, path string) (Migrator, error)

Directories

Path Synopsis
migrator module

Jump to

Keyboard shortcuts

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