@bostrino/db
v0.1.4
Published
Bostrino platform: pooled/direct Postgres clients, schema-per-app provisioning, and the migration runner.
Readme
@bostrino/db
Connection client, migration runner, and schema/role provisioning helpers for the bostrino-one Neon project.
Neon project
- Org:
Bostrino(org-late-lake-43545426) - Project:
bostrino-one(nameless-shadow-28494287), regionaws-eu-central-1, Postgres 17 - Owner role:
neondb_owner— the migration credential. Fullneon_superusermembership (CREATEROLE,CREATEDB, etc). Used only over the direct connection, only bypnpm migrate, never by the deployed app.
Branches
main— the real database.bostrino-one-run'srole_platformconnects here over the pooled endpoint. Migrations are applied here explicitly (pnpm migrate -- --branch main).dev— created for the future build machine (see the architecture table in the rootREADME.md: the build machine reaches "Neon dev branch only"). Not wired into anything yet — no migrations run against it, nothing reads or writes to it. It exists now so the build machine's eventual isolation (no production secrets, no production database) has a real branch to target instead of being designed against a placeholder.
Ephemeral branches (isolation-test-<timestamp>, created and destroyed automatically by src/isolation.test.ts) are not listed here — they don't outlive a single test run.
Migrations
pnpm migrate -- --branch <name> [--push-fly-secret]--branchis required, always. There is no default, so it's structurally impossible to hit the wrong target by omission.- The direct/migration connection string is fetched live from the
neonCLI for the given branch and role (defaultneondb_owner) — it is never stored in a file or env var for this path. --push-fly-secretonly matters the first timerole_platform(or a future app role) is created — it pushes the freshly generated password straight tofly secrets setonbostrino-one-run, entirely in-memory, never printed. Omit it to just apply schema/role changes without touching Fly.- Re-running is always safe — already-applied migrations are skipped (tracked in
public.schema_migrations).
For local development against your own branch instead of bostrino-one, copy .env.example to .env.local and set MIGRATION_DATABASE_URL there.
Tests
pnpm test runs the pure unit tests (provision.test.ts) plus isolation.test.ts, which requires the neon CLI to be authenticated in the running environment — it creates a real ephemeral Neon branch, proves the five isolation assertions against it, and deletes the branch afterward regardless of outcome. It never touches main.
