api9nin / src /lib /db /migrations /001-initial.js
github-actions[bot]
deploy from github actions 2026-06-18
c8ae75d
Raw
History Blame Contribute Delete
456 Bytes
// Initial schema bootstrap. For fresh DB this creates all tables/indexes.
// For existing DB at version 0 (legacy unstamped), it's idempotent (IF NOT EXISTS).
import { TABLES, buildCreateTableSql } from "../schema.js";
export default {
version: 1,
name: "initial",
up(db) {
for (const [name, def] of Object.entries(TABLES)) {
db.exec(buildCreateTableSql(name, def));
for (const idx of def.indexes || []) db.exec(idx);
}
},
};