https://github.com/go-rel/migration
Database Migration utility for REL
https://github.com/go-rel/migration
database go golang hacktoberfest mysql
Last synced: 3 months ago
JSON representation
Database Migration utility for REL
- Host: GitHub
- URL: https://github.com/go-rel/migration
- Owner: go-rel
- License: mit
- Created: 2022-02-23T06:02:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-02T00:39:14.000Z (7 months ago)
- Last Synced: 2025-04-10T07:28:31.619Z (3 months ago)
- Topics: database, go, golang, hacktoberfest, mysql
- Language: Go
- Homepage:
- Size: 57.6 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# migration
[](https://pkg.go.dev/github.com/go-rel/migration)
[](https://github.com/go-rel/migration/actions/workflows/test.yml)
[](https://goreportcard.com/report/github.com/go-rel/migration)
[](https://codecov.io/gh/go-rel/migration)
[](https://gitter.im/go-rel/rel)Database Migration utility for Golang.
## Example
```go
package mainimport (
"context""github.com/go-rel/doc/examples/db/migrations"
"github.com/go-rel/mysql"
"github.com/go-rel/rel"
"github.com/go-rel/rel/migrator"
_ "github.com/go-sql-driver/mysql"
)func main() {
var (
ctx = context.TODO()
repo = rel.New(mysql.MustOpen("root@(source:3306)/rel_test?charset=utf8&parseTime=True&loc=Local"))
m = migrator.New(repo)
)// Register migrations
m.Register(20202806225100, migrations.MigrateCreateTodos, migrations.RollbackCreateTodos)// Run migrations
m.Migrate(ctx)
// OR:
// m.Rollback(ctx)
}
```More Info: https://go-rel.github.io/migration
## License
Released under the [MIT License](https://github.com/go-rel/migration/blob/master/LICENSE)