2017-11-29 13:32:57 -08:00
|
|
|
// knex migrations use dynamic requires which break with webpack.
|
|
|
|
// This hack makes the migrations directory a constant so that at least we can use webpack contexts for the
|
|
|
|
// require.
|
2020-05-15 12:01:51 +01:00
|
|
|
module.exports = function (source) {
|
2022-09-27 14:43:27 -03:00
|
|
|
return (
|
|
|
|
source
|
|
|
|
.toString()
|
2023-08-03 18:55:46 -04:00
|
|
|
// IMPORTANT: this is known to work with knex v2.5.0. It will most likely break
|
2022-09-27 14:43:27 -03:00
|
|
|
// if knex is upgraded. This is really a hack and should be replaced by a more sustainable
|
|
|
|
// webpack configuration.
|
2023-08-03 18:55:46 -04:00
|
|
|
.replace(
|
|
|
|
'importFile(_path)',
|
|
|
|
"require('./migrations/'+migrationsInfo.file)",
|
|
|
|
)
|
2022-09-27 14:43:27 -03:00
|
|
|
);
|
2020-04-27 18:33:41 +01:00
|
|
|
};
|