mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-02 17:20:39 +00:00
Merge pull request #2033 from balena-os/knex-bug-2032
Fix migrations hardcode to work with knex 0.95.15
This commit is contained in:
commit
4863303270
@ -2,10 +2,12 @@
|
||||
// This hack makes the migrations directory a constant so that at least we can use webpack contexts for the
|
||||
// require.
|
||||
module.exports = function (source) {
|
||||
return source
|
||||
.toString()
|
||||
.replace(
|
||||
'path.join(absoluteDir, migration.file)',
|
||||
`'./migrations/'+migration.file`,
|
||||
);
|
||||
return (
|
||||
source
|
||||
.toString()
|
||||
// IMPORTANT: this is known to work with knex v0.95.15. It will most likely break
|
||||
// if knex is upgraded. This is really a hack and should be replaced by a more sustainable
|
||||
// webpack configuration.
|
||||
.replace('importFile(_path)', "require('./migrations/'+migration.file)")
|
||||
);
|
||||
};
|
||||
|
@ -103,7 +103,10 @@ module.exports = function (env) {
|
||||
{
|
||||
include: [
|
||||
new RegExp(
|
||||
_.escapeRegExp(path.join('knex', 'lib', 'migrate', 'sources')),
|
||||
_.escapeRegExp(
|
||||
// this is the path as of knex@0.95.15
|
||||
path.join('knex', 'lib', 'migrations', 'migrate', 'sources'),
|
||||
),
|
||||
),
|
||||
],
|
||||
use: require.resolve('./build-utils/hardcode-migrations'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user