Open unnoq opened 11 months ago
How are you keeping the databases in sync?
@Angelelz Both connections originate from Neon, which means they interact with the same database.
I guess this was not the intended use-case. I guess you can just cast it:
const read = drizzleNeon(neon(env.DATABASE_URL), { schema, logger: env.WORKER_ENV === 'development' }) as typeof write
@Angelelz Currently, I am doing something similar, but it's not ideal. I'm not sure if it's completely safe.
I don't think you'll have a problem, the underlying runtime lives in "drizzle-orm/sqlite-core" and the stuff that's different extends the same sqlite classes. I'm not sure what can be done at the drizzle side for this, other than making the types more relaxed? The other suggestion is to just have 2 different db objects and import the appropriate one depending on what you need to do.
Describe what you want
Here is my code, and I have tested it. However, it has a TypeScript error. I am unsure if this is not allowed or just a TypeScript error.
If you're wondering why I'm combining
postgres
andneon
, it's becauseneon
doesn't support transactions yet.