Permalink
Browse files

Fix #82 dry-run-on-first-migration-fails

Just checking that result is defined :
When using `--dry-run`, `PgDriver.runSql` return the callback with no parameters.
As we don't really run the query against the database, we don't have any result.
  • Loading branch information...
1 parent eaecab4 commit f7f35234ef8b669fef6c21386620d36df92bcd9b @jgoyon jgoyon committed Oct 7, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/driver/pg.js
View
4 lib/driver/pg.js
@@ -57,7 +57,7 @@ var PgDriver = Base.extend({
return callback(err);
}
- if (result.rows && result.rows.length > 0 && result.rows[0].version) {
+ if (result && result.rows && result.rows.length > 0 && result.rows[0].version) {
var version = result.rows[0].version;
var match = version.match(/\d+\.\d+\.\d+/);
if (match && match[0] && semver.gte(match[0], '9.1.0')) {
@@ -70,7 +70,7 @@ var PgDriver = Base.extend({
return callback(err);
}
- if (result.rows && result.rows.length < 1) {
+ if (result && result.rows && result.rows.length < 1) {
this.createTable('migrations', options, callback);
} else {
callback();

0 comments on commit f7f3523

Please sign in to comment.