Closed
Description
Signal
We want a relational read API, the strongest Drizzle feature:
Db.findMany(Units, {
where: ($) => [$.orgId.eq(orgId)],
with: { listing: true, locks: { with: { gateway: true } } },
})
// rows decoded by a Schema derived from the tables and relationsWhy (MyRemotely)
- 61 Prisma
include:sites and 1,560select: {objects. Many of them are nested. - Without this, every nested read becomes manual joins and regrouping in app code.
Design notes
- Relations come from the table definitions: foreign keys plus
relations()metadata (the Prisma importer fills it in). - One SQL statement per read, with JSON aggregation per dialect:
json_group_array/json_objecton SQLite,JSON_ARRAYAGGon MySQL,jsonb_aggon Postgres. Drizzle RQB v2 does the same. - Tenant analysis covers the nested subqueries.
- Beyond Drizzle: the nested result decodes through codecs, so a
DateTimeinside a nested JSON comes back asDateTime.Utc, not as a string.
Part of #52: the CAFE-stack roadmap signal from MyRemotely. This shows the direction we want, and it is not a demand. We can send a PR if you accept the idea.
Metadata
Metadata
Assignees
Labels
No labels
Activity