Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Knex CLI calls process.chdir() before opening Knexfile (#3661)
- Loading branch information
1 parent
88d832c
commit 2c206a8
Showing
3 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// This knexfile recreates the issue that was identified here: | ||
// | ||
// https://github.com/knex/knex/issues/3660 | ||
// | ||
|
||
const path = require('path'); | ||
|
||
// Notice: this path will resolve relative to `process.cwd()` . | ||
// This will cause a problem if the Knex CLI opens the knexfile | ||
// before changing the cwd. | ||
const MIGRATIONS_DIR = path.resolve('knexfile_migrations'); | ||
|
||
module.exports = { | ||
client: 'sqlite3', | ||
connection: { | ||
filename: __dirname + '/../test.sqlite3', | ||
}, | ||
migrations: { | ||
directory: MIGRATIONS_DIR, | ||
}, | ||
seeds: { | ||
directory: './knexfile_seeds', | ||
}, | ||
}; |