We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Motivation
Currently, we depend on node-postgres automagically detecting the Cloudflare runtime by:
Implementation
We shouldn't have to force our user agent to Cloudflare. We should allow passing in a string forcing it to use pg-cloudflare.
The text was updated successfully, but these errors were encountered:
To implement the feature to force pg-cloudflare, follow these steps:
Modify src/runtime/deps.ts:
src/runtime/deps.ts
node-postgres
pg-cloudflare
export { QueryClient, Transaction } from "https://your-forked-repo-url/mod.ts";
Update src/runtime/postgres.ts:
src/runtime/postgres.ts
getOrCreatePool
public getOrCreatePool(module: Module, forceCloudflare: boolean = false): Pool | undefined { if (!module.db) return undefined; if (this.isShutDown) throw new Error("Postgres is shutting down"); if (this.pools.has(module.db.name)) { return this.pools.get(module.db.name)!; } else { const url = getDatabaseUrl(module.db.name).toString(); // Create & insert pool const output = module.db.createPrisma(url, { forceCloudflare }); const pool = { prisma: output.prisma, pgPool: output.pgPool, } as Pool; this.pools.set(module.db.name, pool); return pool; } }
Update createPrisma method in the relevant module:
createPrisma
forceCloudflare
function createPrisma(url: string, options: { forceCloudflare: boolean }) { // Logic to force pg-cloudflare based on the options }
/src/runtime/deps.ts /src/runtime/postgres.ts
Ask Greptile
Sorry, something went wrong.
OGBE-162 Fork node-postgres to add option to force pg-cloudflare
@NathanFlurry I would like to work upon this issue
No branches or pull requests
Motivation
Currently, we depend on node-postgres automagically detecting the Cloudflare runtime by:
Implementation
We shouldn't have to force our user agent to Cloudflare. We should allow passing in a string forcing it to use pg-cloudflare.
The text was updated successfully, but these errors were encountered: