/** * Adds `dumps.custom_thumbnail_mime`, for thumbnails uploaded by the poster. * * Idempotent: safe to run against a fresh db (already created from schema.sql * with this column) or an existing one that predates it. * * @module */ import type { DatabaseSync } from "node:sqlite"; /** Applies this migration to `db`. */ export function up(db: DatabaseSync): void { const dumpCols = db.prepare(`PRAGMA table_info(dumps);`).all() as { name: string; }[]; if (!dumpCols.some((c) => c.name === "custom_thumbnail_mime")) { db.exec( `ALTER TABLE dumps ADD COLUMN custom_thumbnail_mime TEXT;`, ); } }