feat: add migration to version 10 and update tests

introduced a new config migration to version 10, updated related tests to validate migration.
This commit is contained in:
dswbx
2025-09-24 09:58:22 +02:00
parent aa8bf156b0
commit 832eb6ac31
4 changed files with 672 additions and 5 deletions

View File

@@ -205,7 +205,7 @@ export class DbModuleManager extends ModuleManager {
if (store_secrets) {
updates.push({
version: state.configs.version,
version: version,
type: "secrets",
json: secrets as any,
});
@@ -252,7 +252,7 @@ export class DbModuleManager extends ModuleManager {
if (store_secrets) {
if (!state.secrets || state.secrets?.version !== version) {
await this.mutator().insertOne({
version: state.configs.version,
version,
type: "secrets",
json: secrets,
created_at: date,
@@ -393,7 +393,7 @@ export class DbModuleManager extends ModuleManager {
const version_before = this.version();
const [_version, _configs] = await migrate(version_before, result.configs.json, {
db: this.db,
db: this.db
});
this._version = _version;

View File

@@ -99,6 +99,14 @@ export const migrations: Migration[] = [
};
},
},
{
// remove secrets, automatic
// change media table `entity_id` from integer to text
version: 10,
up: async (config) => {
return config;
},
},
];
export const CURRENT_VERSION = migrations[migrations.length - 1]?.version ?? 0;