Why is $primary only available with read replicas? #2115
janvorwerk
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am currently investigating read replicas with Drizzle & PG/node on my app.
I found an issue that will soon be resolved I hope...
As a workaround to that issue, I was considering using
db.$primary.$with
. The problem is that$primary
does not exist on standard drizzle objects... and I have agetDrizzle()
function that either returnsPgWithReplicas<Q>
orQ
depending on environment... so Typscript considers that it's always Q, w/o the$primary
property.To me, it would be nicer if
$primary
was always defined and would point to self when read replicas are not enabled. The rationale is that a code base should stay identical between staging/production/... environments whether read replicas are turned on for performance reasons or off for economical reasons.What are your thoughts?
Beta Was this translation helpful? Give feedback.
All reactions