feat: add Postgres with Drizzle template - #362
Open
atharvadeosthale wants to merge 3 commits into
Open
atharvadeosthale wants to merge 3 commits into
atharvadeosthale wants to merge 3 commits into
Conversation
A Node.js (TypeScript) function that serves a todo API on Appwrite Postgres through Drizzle ORM. The schema lives in src/schema.ts, and drizzle-kit generates the SQL migrations in drizzle/. The function applies pending migrations on its first execution. The only setting is DATABASE_URL. drizzle-kit depends on an esbuild version with a moderate advisory through @esbuild-kit/core-utils, which fails npm audit. An npm override moves that copy to ^0.25.12; migrations generate the same SQL.
atharvadeosthale
force-pushed
the
feat/postgres-with-drizzle
branch
from
September 25, 2026 06:21
77e87ff to
f949657
Compare
|
The function no longer applies migrations when it starts. Developers apply the SQL in drizzle/ themselves with `npm run db:migrate`, which avoids concurrent cold starts racing on the same migration and keeps schema changes out of production requests. Todo IDs must now be decimal digits within the range of a Postgres integer. Before, Number() accepted values like `/0x10` as ID 16, and IDs above 2147483647 caused a database error instead of a 404.
atharvadeosthale
force-pushed
the
feat/postgres-with-drizzle
branch
2 times, most recently
from
September 25, 2026 06:32
b0b5203 to
e9203df
Compare
Some transaction-mode poolers, such as PgBouncer before 1.21, route consecutive queries to different backends, so a statement prepared on one backend is missing on the next.
Member
Author
|
@greptileai review |
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 does this PR do?
Adds
node-typescript/postgres-with-drizzle, a function that serves a todo API on Appwrite Postgres through Drizzle ORM.GET /POST /{ title }GET /:idPATCH /:idtitleorcompletedDELETE /:idsrc/schema.ts, and the generated SQL migrations live indrizzle/.npm run db:migrateand create new ones withnpm run db:generate.DATABASE_URL, the database's connection string.drizzle-kitpulls in anesbuildversion with a moderate advisory through@esbuild-kit/core-utils, which failsnpm audit. An npmoverridemoves that copy to^0.25.12. Migrations still generate the same SQL.Test Plan
Deployed as a Node 22 function against an Appwrite Postgres database:
todostable.npm run db:migratecreatedtodosand Drizzle's migrations table. A second run changed nothing.completed, an empty update, a missing todo, and an unsupported method./0x1,/1e0,/1.0,/0,/-1,/2147483648,/abcand/1/extra.npm ci --ignore-scripts,npm run build,npm audit(0 vulnerabilities) andprettier --checkpass.drizzle-kit generatereports no schema drift.The
npmaudit job fails on six existing templates that this PR doesn't change:email-contact-form,generate-pdf,password-expiry,payments-with-stripe,subscriptions-with-stripeandsync-with-pinecone.Related PRs and Issues
None.
Have you read the Contributing Guidelines on issues?
Yes.