Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): snapshot service-update databases with VACUUM INTO #8431

ClosedAdolanium(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/8431/headopened View on GitHub

Showing 2 changed files with 108 additions and 15 deletions.

x
0 of 2 viewed, 2 left
82 additions and 7 deletionsapps/server/src/serviceLauncher.test.tsModified
View file
@@ -3,8 +3,18 @@
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
+import * as NodeFS from "node:fs";
+import * as NodeFSP from "node:fs/promises";
+import * as NodeOS from "node:os";
+import * as NodePath from "node:path";
+import { DatabaseSync } from "node:sqlite";
​
-import { Launcher, readServiceState, writeServiceState } from "./serviceLauncher.ts";
+import {
+ Launcher,
+ readServiceState,
+ vacuumDatabaseInto,
+ writeServiceState,
+} from "./serviceLauncher.ts";
import {
compareExactServiceVersions,
decodeServiceState,
@@ -32,6 +42,58 @@
assert.equal(compareExactServiceVersions("2.0.0+one", "2.0.0+two"), 0);
});
​
+function seedSqlite(databasePath: string): void {
+ const seed = new DatabaseSync(databasePath);
+ try {
+ seed.exec(
+ "CREATE TABLE kv (k TEXT PRIMARY KEY, v TEXT NOT NULL); INSERT INTO kv VALUES ('phase', 'before');",