Skip to content

use path.join #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 15, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this comes a bit late, but if you're that pernickety, while you're obviously right, path.join should be used correctly anyway ;)

So instead of \'/sqls/' + this.name.replace( placing this.name.replace as another argument as path.join accepts an unlimited amount of parameters.
If you change this, then I'm going to merge this one.

'.js', '') + '-up.sql\');',
' return new Promise( function( resolve, reject ) {',
' fs.readFile(filePath, {encoding: \'utf-8\'}, function(err,data){',
Expand All @@ -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){',
Expand Down