/** * Build drizzle tables at runtime from an introspected schema. * * A project with declared collections gets its drizzle tables from a generated `schema.generated.ts` that * the developer commits. BaaS mode has no such file — it points at a database * and serves it — so the equivalent table objects are constructed here from * `information_schema` metadata. * * These are handed to drizzle as its schema, which keeps the relational query * path (`db.query.*`) working; without them FetchService would fall back to * plain selects and lose relation loading. */ import { type PgTable } from "drizzle-orm/pg-core"; import { type Relations } from "drizzle-orm"; import type { TableMeta } from "./introspect-db-logic"; /** * Build one drizzle table per introspected table, keyed by table name. */ export declare function buildDrizzleTablesFromSchema(tablesMap: Map, pgSchemaName?: string): Record; /** * Build drizzle `relations()` for the foreign keys, so the relational query * path can actually load them. * * FetchService asks drizzle for `with: { : true }`, keyed by the relation * property on the collection. Tables alone don't satisfy that — without these, * `?include=author` silently returns the raw `author_id` and no author. * * The keys here must match `buildRelations` in introspect-runtime.ts, which is * what names the collection's relation properties. */ export declare function buildDrizzleRelationsFromSchema(tablesMap: Map, tables: Record): Record;