Skip to content

Build your personal knowledge base with Trilium Notes

better ide navigation and encapsulation for max migration version

contributor63aa2c6b27f4
diff --git a/packages/trilium-core/src/migrations/migrations.ts b/packages/trilium-core/src/migrations/migrations.ts
index 0c9dd4e8d1..237d5ed307 100644
--- a/packages/trilium-core/src/migrations/migrations.ts
+++ b/packages/trilium-core/src/migrations/migrations.ts
@@ -3,9 +3,12 @@
*
* Contains all the migrations that are run on the database.
*/
+export function getMaxMigrationVersion() {
+ return MIGRATIONS[0].version;
+}
// Migrations should be kept in descending order, so the latest migration is first.
-const MIGRATIONS: (SqlMigration | JsMigration)[] = [
+export const MIGRATIONS: (SqlMigration | JsMigration)[] = [
// Add description column to revisions table for manual revision comments
{
version: 238,
@@ -351,10 +354,6 @@ const MIGRATIONS: (SqlMigration | JsMigration)[] = [
}
];
-export default MIGRATIONS;
-
-export const MAX_MIGRATION_VERSION = MIGRATIONS[0].version;
-
interface Migration {
version: number;
/** If true, errors during this migration are logged but do not halt the migration process. Useful for migrations that may have already been applied (e.g. adding a column that already exists). */
diff --git a/packages/trilium-core/src/services/app_info.ts b/packages/trilium-core/src/services/app_info.ts
index a860dbe81f..70d5251f19 100644
--- a/packages/trilium-core/src/services/app_info.ts
+++ b/packages/trilium-core/src/services/app_info.ts
@@ -1,14 +1,14 @@
import build from "./build.js";
import packageJson from "../../package.json" with { type: "json" };
import { AppInfo } from "@triliumnext/commons";
-import { MAX_MIGRATION_VERSION } from "../migrations/migrations.js";
+import { getMaxMigrationVersion } from "../migrations/migrations.js";
const SYNC_VERSION = 39;
const CLIPPER_PROTOCOL_VERSION = "1.0";
const appInfo: AppInfo = {
appVersion: packageJson.version,
- dbVersion: MAX_MIGRATION_VERSION,
+ dbVersion: getMaxMigrationVersion(),
syncVersion: SYNC_VERSION,
buildDate: build.buildDate,
buildRevision: build.buildRevision,