Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/trilium-core/src/migrations/migrations.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";

import MIGRATIONS from "./migrations.js";
import { MIGRATIONS } from "./migrations.js";

describe("migrations", () => {
it("should have unique version numbers", () => {
Expand Down
9 changes: 4 additions & 5 deletions packages/trilium-core/src/migrations/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
*
* Contains all the migrations that are run on the database.
*/
export function getMaxMigrationVersion() {
return MIGRATIONS[0].version;
}
Comment thread
eliandoran marked this conversation as resolved.

// 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,
Expand Down Expand Up @@ -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). */
Expand Down
4 changes: 2 additions & 2 deletions packages/trilium-core/src/services/app_info.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/trilium-core/src/services/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getPlatform } from "./platform.js";
import appInfo from "./app_info.js";
import * as cls from "./context.js";
import { t } from "i18next";
import MIGRATIONS from "../migrations/migrations.js";
import { MIGRATIONS } from "../migrations/migrations.js";

interface MigrationInfo {
dbVersion: number;
Expand Down
Loading