Merge pull request #28 from Retropex/migration

migration
This commit is contained in:
Léo Haf 2025-03-12 10:58:03 +01:00 committed by GitHub
commit 789d493faf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import { compat, types as T } from "../dependencies.ts";
import { compat, matches, types as T } from "../dependencies.ts";
export const migration: T.ExpectedExports.migration =
compat.migrations.fromMapping(
@ -15,6 +15,33 @@ export const migration: T.ExpectedExports.migration =
{ version: "27.1.0", type: "down" }
),
},
"28.1.0.1": {
up: compat.migrations.updateConfig(
(config) => {
if (
!matches
.shape({
advanced: matches.shape({
blocknotify: matches.any,
}),
})
.test(config)
) {
throw new Error("Upgrading from Core to Knots is prohibited.");
}
return config;
},
true,
{
version: "28.1.0.1",
type: "up",
}
),
down: compat.migrations.updateConfig((config: any) => config, true, {
version: "28.1.0.1",
type: "down",
}),
},
},
"27.1.0"
"28.1.0.1"
);