Files
harbor-net/scripts/check-sqlite-runtime.mjs
dokril 1ae23d848b
Build and Deploy Gateway / build-and-push (push) Successful in 1m22s
Build and Deploy Gateway / deploy (push) Successful in 16s
Migrate Harbor state and traffic history to SQLite
2026-09-10 19:21:21 +03:00

20 lines
963 B
JavaScript

import assert from 'node:assert/strict';
import { DatabaseSync } from 'node:sqlite';
assert.equal(process.versions.node, '24.21.0', 'Harbor requires the pinned Node 24.21.0 runtime');
const db = new DatabaseSync(':memory:');
try {
const version = db.prepare('SELECT sqlite_version() AS version').get().version;
const [major, minor, patch] = version.split('.').map(Number);
assert.ok(major > 3 || (major === 3 && (minor > 51 || (minor === 51 && patch >= 3))),
'Harbor requires SQLite >= 3.51.3 with the WAL-reset fix');
db.exec('CREATE TABLE probe (bytes INTEGER NOT NULL) STRICT');
db.prepare('INSERT INTO probe VALUES (?)').run(9007199254740993n);
const statement = db.prepare('SELECT bytes FROM probe');
statement.setReadBigInts(true);
assert.equal(statement.get().bytes, 9007199254740993n);
console.log(`Harbor runtime: Node ${process.versions.node}, SQLite ${version}, ${process.platform}/${process.arch}`);
} finally {
db.close();
}