Coder Social home page Coder Social logo

pajamas's Introduction

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.

pajamas's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.