kamimai

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 2 Imported by: 0

README

Kamimai - 紙舞

A migration manager written in Golang. Use it in run commands via the CLI.

GoDoc Build Status codecov Go Report Card

Installation

kamimai is written in Go, so if you have Go installed you can install it with go get:

go get github.com/eure/kamimai/cmd/kamimai

Make sure that kamimai was installed correctly:

kamimai -h

Usage:

Create
# create new migration files
kamimai -path=./example/mysql -env=test1 create migrate_name
Up
# apply all available migrations
kamimai -path=./example/mysql -env=test1 up

# apply the next n migrations
kamimai -path=./example/mysql -env=test1 up n

# apply the given version migration
kamimai -path=./example/mysql -env=test1 up -version=20060102150405
Down
# rollback the previous migration
kamimai -path=./example/mysql -env=test1 down

# rollback the previous n migrations
kamimai -path=./example/mysql -env=test1 down n

# rollback the given version migration
kamimai -path=./example/mysql -env=test1 down -version=20060102150405
Sync
# sync all migrations
kamimai -path=./example/mysql -env=test1 sync

Usage in Go code

package main

import (
	"github.com/eure/kamimai"
	"github.com/eure/kamimai/core"
	_ "github.com/eure/kamimai/driver"
)

func main() {
	conf, err := core.NewConfig("examples/testdata")
	if err != nil {
		panic(err)
	}
	
	conf.WithEnv("development")
	
	// Sync
	kamimai.Sync(conf)

	// ...

Drivers

Availables
  • MySQL
Plan
  • SQLite
  • PostgreSQL
  • and more

License

The MIT License (MIT)

Documentation

Index

Constants

View Source
const Version = "v0.2.1"

Version represents kamimai's semantic version.

Variables

This section is empty.

Functions

func Current

func Current(c *core.Config) (uint64, error)

Current returns the current migration version.

func Down

func Down(c *core.Config) error

Down applies down migration files.

func Sync

func Sync(c *core.Config) error

Sync applies non-applied migration files.

func Up

func Up(c *core.Config) error

Up applies up migration files.

Types

This section is empty.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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