dbmigrate

package module
v0.0.0-...-e26edde Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: MIT Imports: 8 Imported by: 1

README

Hello :) There is a much better tool available now, check out github.com/wallester/migrate

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMigrations

func ApplyMigrations(database Database, migrationsFolder string) error

Run applies migrations from migrationsFolder to database.

func Run

func Run(db *sql.DB, migrationsFolder string) error

By default, apply Postgresql migrations, as in older versions

Types

type CassandraDatabase

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

func NewCassandraDatabase

func NewCassandraDatabase(readerSession *gocql.Session, writerSession *gocql.Session) *CassandraDatabase

func (*CassandraDatabase) CreateMigrationsTable

func (cassandra *CassandraDatabase) CreateMigrationsTable() error

func (*CassandraDatabase) HasMigrated

func (cassandra *CassandraDatabase) HasMigrated(filename string) (bool, error)

func (*CassandraDatabase) Migrate

func (cassandra *CassandraDatabase) Migrate(filename string, migration string) error

type Database

type Database interface {
	CreateMigrationsTable() error
	HasMigrated(filename string) (bool, error)
	Migrate(filename string, migration string) error
}

type PostgresDatabase

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

func NewPostgresDatabase

func NewPostgresDatabase(db *sql.DB) *PostgresDatabase

func (*PostgresDatabase) CreateMigrationsTable

func (postgres *PostgresDatabase) CreateMigrationsTable() error

func (*PostgresDatabase) HasMigrated

func (postgres *PostgresDatabase) HasMigrated(filename string) (bool, error)

func (*PostgresDatabase) Migrate

func (postgres *PostgresDatabase) Migrate(filename string, migration string) error

Jump to

Keyboard shortcuts

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