mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user