migrago

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 11 Imported by: 0

README

migrago

Database migration tool for go projects

Currently only supports postgres databases

WARNING

This is a work in progress and should not be used in production

features

  • Database migration
  • Rollback migration
  • Configurable migration directory
  • Support postgres
  • Support mysql
  • Support sqlite

installation

use the following command to install the package

go get github.com/Soemii/migrago@v1.0.0

usage

db, err := sql.Open("postgres", dsn)
if err != nil {
	return nil, err
}
fs := os.DirFS("migration")
service := migrago.NewMigrationService("config.json", "scripts", fs, db)
err = service.ExecuteMigration(context.Background())

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	Id           string
	Script       string
	RevertScript string
	Checksum     string
}

type MigrationService

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

func NewMigrationService

func NewMigrationService(configFile, scriptPath string, fs fs.FS, conn *sql.DB) MigrationService

MigrationService constructor

func (MigrationService) ExecuteMigration

func (m MigrationService) ExecuteMigration(ctx context.Context) error

ExecuteMigration orchestrates the migration execution process

Jump to

Keyboard shortcuts

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