feat: v0.1.0 — sqlite-migrate package extraction from authd #1
Reference in New Issue
Block a user
Delete Branch "feat/initial-package"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
v0.1.0 of
bchen-sqlite-migrate. Lifted from authd (PR #14 / merge_commitced21ab4d16c28a6b5fafa9072b0ae8207ba4bfd) into a standalone ESM-only package installable viagit+https://gitea.bchen.dev/brendan/sqlite-migrate.git#v0.1.0.One deliberate API change vs. authd's source: the previously-hardcoded
GENESIS_PROBE_TABLE = 'users'is now anApplyOptions.genesisProbeTable?: stringparameter (default'users', preserving authd back-compat).What's in v0.1.0
applyMigrations(db, dir, opts?)— forward-only runner with checksum guard, idempotent re-apply, transactional per-migration, genesis-stamping for pre-existing prod DBs.listMigrations(dir),readAppliedRows(db),stampMigration(db, dir, version)— introspection + manual stamp helpers.runMigrateCli({ openDb, migrationsDir, command, ... })— sub-path exportbchen-sqlite-migrate/cli; consumers wire a ~5-line shim.dist/*.js+dist/*.d.ts(ESM, Node 20+).better-sqlite3 >=11 <13(resolved to 12.6.2 in devDeps to match authd).vitest@^4.0.0— installed as 4.1.6 from npm.Test coverage
genesisProbeTableparameterization:probe-table-not-present + stampGenesis=false-> first migration runs normally.genesisProbeTable=undefineddefaults to'users'(authd back-compat).genesisProbeTable='sessions'correctly stamps a buchinese-shaped DB.runMigrateCli(migrate / status / stamp + missing-version error path).npm test.Lockfile-verified
npm cion linux/x64 sandbox after a cleanrm -rf node_modulespasses typecheck + build + test +git diff --exit-code dist/(the CI parity flow). No Dockerfile since this is a published-package repo, not a deployed service. Cold install fromgit+https://gitea.bchen.dev/...#v0.1.0will be exercised when the first adoption PR lands.Pack surface
npm pack --dry-runlists exactly:LICENSE,README.md,dist/cli.{d.ts,js},dist/index.{d.ts,js},dist/migrate.{d.ts,js},package.json. Nosrc/ortests/leak.Security
None. This is a server-side library with no HTTP surface, no secret handling, no user input crossing a trust boundary.
db.exec(file.body)runs migration SQL verbatim — by design (migrations are trusted, committed-to-repo SQL). README documents the consumer responsibility (don't pointmigrationsDirat untrusted content).Environment
None. No new env vars introduced.