mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 17:17:37 +02:00
fix(server): wrong DB version (closes #9418)
This commit is contained in:
17
apps/server/src/migrations/migrations.spec.ts
Normal file
17
apps/server/src/migrations/migrations.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import MIGRATIONS from "./migrations.js";
|
||||
|
||||
describe("migrations", () => {
|
||||
it("should have unique version numbers", () => {
|
||||
const versions = MIGRATIONS.map((m) => m.version);
|
||||
const uniqueVersions = new Set(versions);
|
||||
expect(versions.length).toBe(uniqueVersions.size);
|
||||
});
|
||||
|
||||
it("should be sorted in descending order by version", () => {
|
||||
for (let i = 1; i < MIGRATIONS.length; i++) {
|
||||
expect(MIGRATIONS[i - 1].version, `migration at index ${i - 1} (v${MIGRATIONS[i - 1].version}) should be greater than migration at index ${i} (v${MIGRATIONS[i].version})`).toBeGreaterThan(MIGRATIONS[i].version);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -344,6 +344,8 @@ 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). */
|
||||
|
||||
@@ -2,16 +2,16 @@ import { AppInfo } from "@triliumnext/commons";
|
||||
import path from "path";
|
||||
|
||||
import packageJson from "../../package.json" with { type: "json" };
|
||||
import { MAX_MIGRATION_VERSION } from "../migrations/migrations.js";
|
||||
import build from "./build.js";
|
||||
import dataDir from "./data_dir.js";
|
||||
|
||||
const APP_DB_VERSION = 236;
|
||||
const SYNC_VERSION = 38;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
export default {
|
||||
appVersion: packageJson.version,
|
||||
dbVersion: APP_DB_VERSION,
|
||||
dbVersion: MAX_MIGRATION_VERSION,
|
||||
nodeVersion: process.version,
|
||||
syncVersion: SYNC_VERSION,
|
||||
buildDate: build.buildDate,
|
||||
|
||||
Reference in New Issue
Block a user