migrate from hono

This commit is contained in:
JCEEE
2026-08-17 07:41:26 +01:00
parent e2b99c45b6
commit 5204e7bdbc
56 changed files with 1815 additions and 3357 deletions
+16
View File
@@ -0,0 +1,16 @@
import { migrate } from './migrate';
// Runs the PocketBase schema migration once per server process, at boot.
// Idempotent (migrate() diffs against existing collections), so re-running on
// dev HMR or restarts is a cheap no-op. Errors are logged, not thrown, so a
// migration hiccup never takes the server down.
let done: Promise<void> | null = null;
export function migrateOnBoot(): Promise<void> {
if (!done) {
done = migrate().catch((e) => {
console.error('[migrate] failed:', e);
});
}
return done;
}