migrations

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

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 6 Imported by: 0

README

Description

Migrations lib for Golang sql

GitHub licenseGitHub starsGitHub issues GitHub issues

Requirements

  • Go 1.18+
  • MySQL

Test

    $go test

Examples

Up to MAX version

package main

import (
    "github.com/c0de4un/migrations"
    "fmt"
)

func main() {
    err := migrations.Up("/configs/db.xml")
    if err != nil {
        fmt.Error(err)
    }
}

Down to specific version

package main

import (
    "github.com/c0de4un/migrations"
    "fmt"
)

func main() {
    err := migrations.Down("/configs/db.xml", 13)
    if err != nil {
        fmt.Error(err)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Down

func Down(dir string, version int, db *sql.DB) error

func Up

func Up(dir string, version int, db *sql.DB) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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