feat: Add the effects to the migrations

This commit is contained in:
BluJ
2022-07-28 09:31:12 -06:00
parent ec2845b0e0
commit 21d93c803f
2 changed files with 4 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ export const getConfig = (spec: ConfigSpec): ExpectedExports.getConfig =>
effects.info(`Got error ${e} while trying to read the config`);
return undefined;
});
return {
result: {
config,

View File

@@ -20,7 +20,7 @@ export function updateConfig<
version extends string,
type extends "up" | "down",
>(
fn: (config: T.Config) => T.Config,
fn: (config: T.Config, effects: T.Effects) => T.Config,
configured: boolean,
noRepeat?: NoRepeat<version, type>,
noFail = false,
@@ -30,7 +30,7 @@ export function updateConfig<
let config = util.unwrapResultType(await getConfig({})(effects)).config;
if (config) {
try {
config = fn(config);
config = fn(config, effects);
} catch (e) {
if (!noFail) {
throw e;