Skip to content

freeformz/pajamas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Migration Example App

This app doesn't contain any migrations, but is an example of using migrate with godep and heroku.

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 <your app>
  2. Write your code. Simulated with a simple main.go here.
  3. go get -u github.com/mattes/migrate
  4. mkdir -p cmd/migrate
  5. cp $GOPATH/src/github.com/mattes/migrate/{main,version}.go cmd/migrate
  6. godep save -r ./...
  7. git add -A .
  8. git commit -am "includes migration"
  9. git push heroku master

Pushing this repo to a heroku application will produce 2 binaries in /bin: pajamas and mirgate.

Using heroku run migrate <args> then allows you to process any otherwise recorded migrations.

FWIW: I consider this a workaround looking for a better, longer term solution.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages