feat(evi): wire a Postgres store behind an isDbConfigured guard - #560
Merged
Conversation
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).
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
HugoRCD
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires the provisioned Postgres store (production, preview-branched, and local databases from EVL-257) into
apps/evias a Drizzle layer, matching the stack the telemetry app already runs:drizzle-orm+ thepostgresdriver, with the connection URL read fromDATABASE_URL(falling back toPOSTGRES_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:migratescripts — migration pipeline;generateruns without a DB,migrateneeds a real connection stringagent/lib/db.ts—databaseUrl(),isDbConfigured(), and a memoizedgetDb()that returnsnullwhen unconfigured instead of throwing, so local runs without the DB keep workingagent/lib/db.test.ts— env resolution and guard behavior.env.exampledocumenting the connection variables;vercel env pullinapps/eviprovides the real valuesThe empty
db/migrations/meta/_journal.jsoncommits the migrations location; the first.sqlmigration is generated when the first table is added.Checks
vitest run(apps/evi): 15 files, 91 tests passed, including the 5 new db testseslinton the changed files: cleantypecheck(tsc): passes for the changed files; the app as a whole has one pre-existing error inagent/hooks/evlog.ts(distinctIdFieldvsdistinctIdon PostHog config) that fails identically onmain— not introduced heremain, unchanged by this PRNo changeset: changes are confined to
apps/*.