Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 636 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 636 Bytes

DB Migrate Database Adapters

Postgres Usage

import "github.com/braindev/dbmigrate/adapter"

// NewPostgres(db *sql.DB) (*PostgresAdapter, error)
pgadapter, err := adapter.NewPostgres(db)

MySQL Usage

import "github.com/braindev/dbmigrate/adapter"

// NewMySQL(db *sql.DB) (*MySQLAdapter, error)
mysqladapter, err := adapter.NewMySQL(db)

Custom Adapter

To create a custom adapter implement the following interface:

type VendorAdapter interface {
	GetAppliedMigrationsOrderedAsc() ([]string, error)
	ApplyMigration(pair MigrationPair) error
	RollbackMigration(pair MigrationPair) error
}