Skip to content

feat(evi): wire a Postgres store behind an isDbConfigured guard - #560

Merged
HugoRCD merged 1 commit into
mainfrom
EVL-257/provision-database
Aug 11, 2026
Merged

feat(evi): wire a Postgres store behind an isDbConfigured guard#560
HugoRCD merged 1 commit into
mainfrom
EVL-257/provision-database

Conversation

@evlogai

@evlogai evlogai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What

Wires the provisioned Postgres store (production, preview-branched, and local databases from EVL-257) into apps/evi as a Drizzle layer, matching the stack the telemetry app already runs: drizzle-orm + the postgres driver, with the connection URL read from DATABASE_URL (falling back to POSTGRES_URL / POSTGRESQL_URL, the names the Vercel Marketplace Neon integration sets).

  • db/schema.ts — schema directory; intentionally empty, tables land with the features that need them (EVL-258 tasks, EVL-253 feedback)
  • drizzle.config.ts + db:generate / db:migrate scripts — migration pipeline; generate runs without a DB, migrate needs a real connection string
  • agent/lib/db.tsdatabaseUrl(), isDbConfigured(), and a memoized getDb() that returns null when unconfigured instead of throwing, so local runs without the DB keep working
  • agent/lib/db.test.ts — env resolution and guard behavior
  • .env.example documenting the connection variables; vercel env pull in apps/evi provides the real values

The empty db/migrations/meta/_journal.json commits the migrations location; the first .sql migration is generated when the first table is added.

Checks

  • vitest run (apps/evi): 15 files, 91 tests passed, including the 5 new db tests
  • eslint on the changed files: clean
  • typecheck (tsc): passes for the changed files; the app as a whole has one pre-existing error in agent/hooks/evlog.ts (distinctIdField vs distinctId on PostHog config) that fails identically on main — not introduced here
  • Monorepo-wide lint: pre-existing failures on main, unchanged by this PR

No changeset: changes are confined to apps/*.

Add a Drizzle + postgres-js layer for Evi's new store, matching the
stack the telemetry app already runs: drizzle-orm 0.45, the postgres
driver, and a connection URL read from DATABASE_URL with POSTGRES_URL /
POSTGRESQL_URL fallbacks.

The database is provisioned (production, preview-branched, local) but
nothing stores in it yet, so the schema stays empty and the first real
migration is generated when the features that need a table land (EVL-258
tasks, EVL-253 feedback). Local runs without the DB keep working via the
isDbConfigured guard, which returns null from getDb instead of throwing.

Adds: db/schema.ts, drizzle.config.ts, db:generate/db:migrate scripts,
an .env.example, and agent/lib/db.ts(+test).
@evlogai
evlogai Bot requested a review from HugoRCD August 11, 2026 19:05
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evi Ready Ready Preview Aug 11, 2026 7:06pm
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
evlog-docs Skipped Skipped v0 Aug 11, 2026 7:06pm
evlog-render-lab Skipped Skipped Aug 11, 2026 7:06pm
evlog-telemetry Skipped Skipped Aug 11, 2026 7:06pm
just-use-evlog Skipped Skipped Aug 11, 2026 7:06pm

Request Review

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4fff0ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@evlog/cli@560
npm i https://pkg.pr.new/evlog@560
npm i https://pkg.pr.new/@evlog/nuxthub@560
npm i https://pkg.pr.new/@evlog/telemetry@560

commit: 4fff0ea

@HugoRCD
HugoRCD merged commit 2b38ba5 into main Aug 11, 2026
19 of 20 checks passed
@HugoRCD
HugoRCD deleted the EVL-257/provision-database branch August 11, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant