Migrate Harbor state and traffic history to SQLite
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user