feat(db): add read replicas
Build and Push Image / build-backend (push) Successful in 1m17s
Build and Push Image / build-frontend (push) Successful in 3m15s
Build and Push Image / push (push) Successful in 53s

This commit is contained in:
2026-08-30 16:19:13 +00:00 Unverified
parent 41b24bd7c2
commit a83015384c
5 changed files with 64 additions and 65 deletions
+7 -1
View File
@@ -1,4 +1,10 @@
import { drizzle } from "drizzle-orm/bun-sql";
import * as schema from "./schema";
import { withReplicas } from "drizzle-orm/pg-core";
export const db = drizzle(process.env.DATABASE_URL!, { schema });
export const db = process.env.REPLICA_DATABASE_URL
? withReplicas(drizzle(process.env.DATABASE_URL!, { schema }), [
drizzle(process.env.REPLICA_DATABASE_URL!, { schema }),
drizzle(process.env.REPLICA_DATABASE_URL!, { schema }),
])
: drizzle(process.env.DATABASE_URL!, { schema });
+1 -1
View File
@@ -56,7 +56,7 @@ export const sse = sseEndpointMap({
},
slip_sync: {
complete: z.custom<TTrackingKey>(),
connected: z.custom<TTrackingKey>()
connected: z.custom<TTrackingKey>(),
},
});
export const adminSseList: (keyof typeof sse)[] = ["log"];