potif/mygrate — pull request #2 by repeatingbeats (2012-07-30 21:49:14+00:00)
Title: Use JS pg client instead of spawning psql process to issue migration queries

This is a relatively simple change to read the sql file in as a string and dispatch that string query using the node postgres client.

As far as I can tell, postgres handles the multiple-statement string query by executing the queries in order in an implicitly wrapped transaction (i.e. if any statement errors, nothing is committed). This is discussed in [this node-postgres issue](https://github.com/brianc/node-postgres/issues/141), though it is not explicitly called out in the (relevant section of the postgres manual)[http://www.postgresql.org/docs/9.1/static/protocol-flow.html] for Simple Queries.

My own testing supports the implicit transaction wrapping, so I guess I'm incline to believe it. Given this, the patch is pretty simple and only requires reading the file and sending the file contents as a query.

As mentioned in [the other PR](https://github.com/potif/mygrate/pull/1), testing approach is going to depend on whether or not our changes are wanted upstream. If so, we'll try to do something amenable to upstream instead of just doing our normal thing.