Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/freeformz/pajamas
https://github.com/freeformz/pajamas
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/freeformz/pajamas
- Owner: freeformz
- Created: 2015-11-04T23:45:01.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-05T02:34:19.000Z (about 9 years ago)
- Last Synced: 2024-12-24T06:47:45.182Z (11 days ago)
- Language: Go
- Size: 1.84 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Migration Example App
This app doesn't contain any migrations, but is an example of using [migrate][migrate] with [godep][godep] and [heroku][heroku].
[godep][godep] only includes files from packages imported in your code. When we want to use a migration tool to help automate database migrations we don't have easy access to the cli commands they provide in the dyno. It's sub optimal to have to run those commands from a local system.
Luckily most of the migration tools are fairly well factored and you can lift their main cli bits out of their packages and into your application. This repo is an example of that.
Using `github.com/mattes/migrate` as an example this repo was constructed by doing the following:
1. `cd `
1. Write your code. Simulated with a simple `main.go` here.
1. `go get -u github.com/mattes/migrate`
1. `mkdir -p cmd/migrate`
1. `cp $GOPATH/src/github.com/mattes/migrate/{main,version}.go cmd/migrate`
1. `godep save -r ./...`
1. `git add -A .`
1. `git commit -am "includes migration"`
1. `git push heroku master`Pushing this repo to a heroku application will produce 2 binaries in `/bin`: `pajamas` and `mirgate`.
Using `heroku run migrate ` then allows you to process any otherwise recorded migrations.
FWIW: I consider this a workaround looking for a better, longer term solution.
[migrate]: https://github.com/mattes/migrate
[godep]: https://github.com/tools/godep
[heroku]: https://heroku.com