From 696a5ea0d76b68cd32b86f5976ad6437cd055471 Mon Sep 17 00:00:00 2001 From: Thomas Reggi Date: Tue, 16 Feb 2016 14:39:36 -0500 Subject: [PATCH 1/3] use path.join --- lib/migration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/migration.js b/lib/migration.js index d581ffac..3ddcae36 100644 --- a/lib/migration.js +++ b/lib/migration.js @@ -122,7 +122,7 @@ Migration.prototype.sqlFileLoaderTemplate = function() { '};', '', 'exports.up = function(db) {', - ' var filePath = path.join(__dirname + \'/sqls/' + this.name.replace( + ' var filePath = path.join(__dirname, \'/sqls/' + this.name.replace( '.js', '') + '-up.sql\');', ' return new Promise( function( resolve, reject ) {', ' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){', @@ -138,7 +138,7 @@ Migration.prototype.sqlFileLoaderTemplate = function() { '};', '', 'exports.down = function(db) {', - ' var filePath = path.join(__dirname + \'/sqls/' + this.name.replace( + ' var filePath = path.join(__dirname, \'/sqls/' + this.name.replace( '.js', '') + '-down.sql\');', ' return new Promise( function( resolve, reject ) {', ' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){', From aca213a3665722b97cf23369a5768f65d5c5e488 Mon Sep 17 00:00:00 2001 From: Thomas Reggi Date: Sun, 17 Apr 2016 22:31:22 -0400 Subject: [PATCH 2/3] path.join change --- lib/migration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/migration.js b/lib/migration.js index 3ddcae36..8b938997 100644 --- a/lib/migration.js +++ b/lib/migration.js @@ -122,7 +122,7 @@ Migration.prototype.sqlFileLoaderTemplate = function() { '};', '', 'exports.up = function(db) {', - ' var filePath = path.join(__dirname, \'/sqls/' + this.name.replace( + ' var filePath = path.join(__dirname, \'sqls\', this.name.replace( '.js', '') + '-up.sql\');', ' return new Promise( function( resolve, reject ) {', ' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){', @@ -138,7 +138,7 @@ Migration.prototype.sqlFileLoaderTemplate = function() { '};', '', 'exports.down = function(db) {', - ' var filePath = path.join(__dirname, \'/sqls/' + this.name.replace( + ' var filePath = path.join(__dirname, \'sqls\', this.name.replace( '.js', '') + '-down.sql\');', ' return new Promise( function( resolve, reject ) {', ' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){', From 0e81f1b6ac3b75f2722585ca6bc0e2883b61fa5d Mon Sep 17 00:00:00 2001 From: Thomas Reggi Date: Sun, 17 Apr 2016 22:32:06 -0400 Subject: [PATCH 3/3] fix --- lib/migration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/migration.js b/lib/migration.js index 8b938997..86a2a639 100644 --- a/lib/migration.js +++ b/lib/migration.js @@ -122,7 +122,7 @@ Migration.prototype.sqlFileLoaderTemplate = function() { '};', '', 'exports.up = function(db) {', - ' var filePath = path.join(__dirname, \'sqls\', this.name.replace( + ' var filePath = path.join(__dirname, \'sqls', this.name.replace( '.js', '') + '-up.sql\');', ' return new Promise( function( resolve, reject ) {', ' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){', @@ -138,7 +138,7 @@ Migration.prototype.sqlFileLoaderTemplate = function() { '};', '', 'exports.down = function(db) {', - ' var filePath = path.join(__dirname, \'sqls\', this.name.replace( + ' var filePath = path.join(__dirname, \'sqls', this.name.replace( '.js', '') + '-down.sql\');', ' return new Promise( function( resolve, reject ) {', ' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){',