Something went wrong. Try again.
A free, open-source, self-hosted place to write a novel.
Something went wrong. Try again.
1.8 kB 50 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051/** * Types for `db-state.mjs`, which is plain JavaScript so `server.js` can load it * before the app. Its importers in `src/` are type-checked, so the shapes are * written down here once. */
import type { DatabaseSync } from 'node:sqlite';
export const SQLITE_BUSY_TIMEOUT_MS: number;
export type DbState = { /** Absolute path to the database, or null when `DATABASE_URL` names none. */ readonly databasePath: string | null; /** False when the file does not exist yet, which is a fresh instance. */ readonly created: boolean; /** Migration names the database holds, in the order they were applied. */ readonly applied: readonly string[]; /** Migration names this build ships, in the order drizzle applies them. */ readonly local: readonly string[]; /** True when the database holds a migration this build does not ship. */ readonly newerThanBuild: boolean; /** The version of the build that last opened the database, when recorded. */ readonly version: string | null; /** When that build opened it, as an ISO string. */ readonly openedAt: string | null; /** Why the read failed. A failed read never stops a boot. */ readonly error: string | null;};
export type BuildIdentity = { readonly version: string; readonly commit: string;};
export function resolveDatabasePath(raw: string | undefined | null): string | null;
export function readLocalMigrations(folder: string): string[];
export function readDbState(options: { databasePath: string | null; migrationsFolder: string; readOnly?: boolean; client?: DatabaseSync;}): DbState;
export function unexpectedMigrations(state: DbState): string[];
export function formatRefusal(state: DbState, build: BuildIdentity): string | null;
export function formatOverrideWarning(state: DbState, build: BuildIdentity): string;