Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -11,7 +11,7 @@ import { db, dbRead } from "~/utils/db.server";
|
||||
await db.user.update({ where: { id }, data: { lastSeenAt: new Date() } });
|
||||
|
||||
// Explicit primary — same client, communicates intent.
|
||||
import { getWriteDbClient } from "@toolctrl/db/client.server";
|
||||
import { getWriteDbClient } from "@hivegrid/db/client.server";
|
||||
|
||||
// Replica — eventually consistent. Use for listings, dashboards, public reads.
|
||||
const users = await dbRead.user.findMany({ where: { tenantId } });
|
||||
@@ -27,7 +27,7 @@ identical and lag = 0.
|
||||
| ---------------------- | ----------------------------------------- |
|
||||
| List endpoints / paginated grids | All mutations (`create`, `update`, `delete`, `upsert`) |
|
||||
| Public marketing pages (sites, portals) | Auth-resolution paths (session → user → tenant) |
|
||||
| Knowledge-base public reads + search | Stripe webhook handlers reading state they just wrote |
|
||||
| Knowledge-base public reads + search | Legacy-Provider webhook handlers reading state they just wrote |
|
||||
| Analytics dashboards & aggregations | Outbox dispatcher reading `PENDING` events (see #42) |
|
||||
| Admin tenant / role enumerations (post-auth) | Anything inside a `db.$transaction(...)` callback |
|
||||
| Dashboard counts (`count()` / `groupBy()`) | Idempotency-key lookups (request-scoped consistency) |
|
||||
@@ -84,7 +84,7 @@ work without code changes. All migrations are zero-risk to roll out.
|
||||
|
||||
## Telemetry
|
||||
|
||||
`@toolctrl/db/telemetry.server` exposes `attachPrismaTelemetry()` — a
|
||||
`@hivegrid/db/telemetry.server` exposes `attachPrismaTelemetry()` — a
|
||||
`$extends({ query })` wrapper that records every operation with
|
||||
`{ client: 'read' | 'write', model, operation, durationMs, ok }`. Wire it
|
||||
in the app bootstrap by adapting the recorder to your metrics sink
|
||||
@@ -109,7 +109,7 @@ steps live with the platform operator.
|
||||
```sql
|
||||
CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD '...';
|
||||
CREATE USER read_user WITH ENCRYPTED PASSWORD '...';
|
||||
GRANT CONNECT ON DATABASE toolctrl TO read_user;
|
||||
GRANT CONNECT ON DATABASE hivegrid TO read_user;
|
||||
GRANT USAGE ON SCHEMA public TO read_user;
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_user;
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
||||
@@ -136,8 +136,8 @@ steps live with the platform operator.
|
||||
3. **App env**:
|
||||
|
||||
```sh
|
||||
DATABASE_URL=postgres://app_user:...@pgbouncer:6432/toolctrl?pgbouncer=true&connection_limit=10
|
||||
DATABASE_READ_URL=postgres://read_user:...@postgres-replica:5432/toolctrl?connection_limit=10
|
||||
DATABASE_URL=postgres://app_user:...@pgbouncer:6432/hivegrid?pgbouncer=true&connection_limit=10
|
||||
DATABASE_READ_URL=postgres://read_user:...@postgres-replica:5432/hivegrid?connection_limit=10
|
||||
```
|
||||
|
||||
Optionally front the replica with its own PgBouncer for connection pooling.
|
||||
|
||||
Reference in new issue
Block a user