https://github.com/z0ne-dev/mgx
pgx native migration system
https://github.com/z0ne-dev/mgx
database-migrations golang pgx
Last synced: 5 months ago
JSON representation
pgx native migration system
- Host: GitHub
- URL: https://github.com/z0ne-dev/mgx
- Owner: z0ne-dev
- License: apache-2.0
- Created: 2023-02-12T11:34:12.000Z (over 3 years ago)
- Default Branch: trunk
- Last Pushed: 2023-08-07T20:11:05.000Z (almost 3 years ago)
- Last Synced: 2024-06-21T12:58:50.794Z (almost 2 years ago)
- Topics: database-migrations, golang, pgx
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![Apache 2.0][license-shield]][license-url]
[![Go Reference][reference-shield]][reference-url]
[![Build][build-shield]][build-url]
[![Coverage][coverage-shield]][coverage-url]
[![Go Report Card][report-shield]][report-url]
[contributors-shield]: https://img.shields.io/github/contributors/z0ne-dev/mgx.svg?
[contributors-url]: https://github.com/z0ne-dev/mgx/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/z0ne-dev/mgx.svg?
[forks-url]: https://github.com/z0ne-dev/mgx/network/members
[stars-shield]: https://img.shields.io/github/stars/z0ne-dev/mgx.svg?
[stars-url]: https://github.com/z0ne-dev/mgx/stargazers
[issues-shield]: https://img.shields.io/github/issues/z0ne-dev/mgx.svg?
[issues-url]: https://github.com/z0ne-dev/mgx/issues
[coverage-shield]: https://codecov.io/gh/z0ne-dev/mgx/branch/trunk/graph/badge.svg
[coverage-url]: https://codecov.io/gh/z0ne-dev/mgx
[license-shield]: https://img.shields.io/github/license/z0ne-dev/mgx.svg?
[license-url]: https://github.com/z0ne-dev/mgx/blob/master/LICENSE.txt
[report-shield]: https://goreportcard.com/badge/github.com/z0ne-dev/mgx?
[report-url]: https://goreportcard.com/report/github.com/z0ne-dev/mgx
[reference-shield]: https://pkg.go.dev/badge/github.com/z0ne-dev/mgx.svg
[reference-url]: https://pkg.go.dev/github.com/z0ne-dev/mgx
[build-shield]: https://github.com/z0ne-dev/mgx/actions/workflows/push-pull.yml/badge.svg
[build-url]: https://github.com/z0ne-dev/mgx/actions/workflows/push-pull.yml
# mgx
Simple migration system for [pgx](https://github.com/jackc/pgx).
Migrations are defined in code and are executed in order.
The migration system keeps track of which migrations have been executed and which have not.
## Getting Started
1. Install the dependency
```sh
go get -u github.com/z0ne-dev/mgx/v2
```
2. Import the package and create a new migrator
```go
package main
import "github.com/z0ne-dev/mgx"
func main() {
migrator, _ := mgx.New(mgx.Migrations(
// insert migrations here
))
}
```
3. Run the `Migrate(context.TODO(), pgx)` method to execute the migrations
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## License
Distributed under the Apache-2.0 License. See `LICENSE` for more information.
## Acknowledgments
* [lopezator/migrator](https://github.com/lopezator/migrator) for inspiration for this package. Lots of inspiration was taken from this package, but it was not used directly. The API was designed to be similar, to reduce refactoring when switching between the two packages.