https://github.com/c0de4un/migrations
Migrations lib for Golang sql
https://github.com/c0de4un/migrations
go golang golang-library migration migrations mysql sql
Last synced: 3 months ago
JSON representation
Migrations lib for Golang sql
- Host: GitHub
- URL: https://github.com/c0de4un/migrations
- Owner: c0de4un
- License: mit
- Created: 2022-04-12T16:07:05.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-16T21:47:46.000Z (almost 4 years ago)
- Last Synced: 2025-04-07T08:42:02.967Z (about 1 year ago)
- Topics: go, golang, golang-library, migration, migrations, mysql, sql
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
Migrations lib for Golang sql
[](https://github.com/c0de4un/migrations/blob/main/LICENSE)[](https://github.com/c0de4un/migrations/stargazers)[](https://github.com/c0de4un/migrations/issues)

# Requirements
* Go 1.18+
* MySQL
# Test
*
```bash
$go test
```
# Examples
## Up to MAX version
```go
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
```go
package main
import (
"github.com/c0de4un/migrations"
"fmt"
)
func main() {
err := migrations.Down("/configs/db.xml", 13)
if err != nil {
fmt.Error(err)
}
}
```