mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-19 07:48:08 +00:00
Fix migrations hardcode to work with knex 0.95.15
The latest upgrade of knex broke the webpack loader that hardcodes the migration paths in the built code, that cause supervisors 14.2.3 to 14.2.5 (inclusive) to break anytime migrations needed to be ran (see linked issue). This commit fixes the loader to work with the included knex version. Relates-to: #2032 Change-type: patch
This commit is contained in:
@ -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)")
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user