Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): t3 doctor can delete the database from before 0.1.0 #20948

Mergedjuliusmarmingemerged 2 commits intot3/v1-cleanup-1-drop-tables fromrefs/pull/20948/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 142 additions and 69 deletions (loading 2).

x
0 of 5 viewed, 5 left
46 additions and 41 deletionsapps/server/src/cli/doctor.test.tsModified
View file
@@ -7,46 +7,51 @@
import { runDoctor } from "./doctor.ts";
import { DatabaseMaintenance } from "../persistence/DatabaseMaintenance.ts";
​
-it.effect("--fix reclaims space with the service paused, and --dry-run changes nothing", () =>
- Effect.gen(function* () {
- const calls: string[] = [];
- const doctor = (dryRun: boolean) =>
- runDoctor("/test/statev2.sqlite", { fix: true, dryRun, interactive: false }).pipe(
- Effect.provide(
- Layer.mergeAll(
- NodeServices.layer,
- Layer.mock(BootService.BootService)({
- withStopped: (operation) =>
- Effect.sync(() => calls.push("pause")).pipe(
- Effect.andThen(operation),
- Effect.ensuring(Effect.sync(() => calls.push("resume"))),
- ),
- }),
- Layer.succeed(DatabaseMaintenance, {
- // An unconverted database: reclaiming space is recommended.
- inspect: () =>
- Effect.succeed({
- databaseBytes: 2000,
- reclaimableBytes: 1000,
- incrementalVacuumEnabled: false,
- }),
- compact: () =>
- Effect.sync(() => {
- calls.push("compact");