{"name":"OKModel","description":"okmodel is a catalog-first TypeScript ORM, PostgreSQL first.","origin":"https://okm.omqkhafi.dev","index":"https://okm.omqkhafi.dev/llms.txt","full":"https://okm.omqkhafi.dev/llms-full.txt","pages":[{"slug":"","title":"Documentation","description":"okmodel is a catalog-first TypeScript ORM, PostgreSQL first.","html":"https://okm.omqkhafi.dev/docs","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/index.md"},{"slug":"ai/llm","title":"LLM","description":"llms.txt lists every handbook page. Fetch that index, then one page.","html":"https://okm.omqkhafi.dev/docs/ai/llm","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/ai/llm.md"},{"slug":"ai/mcp","title":"MCP","description":"okmodel does not ship an MCP server. The browser can register read-only handbook tools.","html":"https://okm.omqkhafi.dev/docs/ai/mcp","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/ai/mcp.md"},{"slug":"ai/skills","title":"Skills","description":"The agent skills in this repository, and the skill the site publishes.","html":"https://okm.omqkhafi.dev/docs/ai/skills","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/ai/skills.md"},{"slug":"define/config","title":"Overview","description":"defineConfig is the file okm reads. Each option is a page.","html":"https://okm.omqkhafi.dev/docs/define/config","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config.md"},{"slug":"define/config/backfill","title":"Backfill","description":"backfill sets batch size, pause, and batch statement timeout.","html":"https://okm.omqkhafi.dev/docs/define/config/backfill","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/backfill.md"},{"slug":"define/config/database","title":"Database","description":"database is one target named default. targets replaces it.","html":"https://okm.omqkhafi.dev/docs/define/config/database","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/database.md"},{"slug":"define/config/external","title":"External","description":"external lists catalog snapshots this project verifies.","html":"https://okm.omqkhafi.dev/docs/define/config/external","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/external.md"},{"slug":"define/config/lint-from","title":"Lint from","description":"lintFrom is the first migration id okm migrate check lints.","html":"https://okm.omqkhafi.dev/docs/define/config/lint-from","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/lint-from.md"},{"slug":"define/config/migrations","title":"Migrations","description":"migrations is where okm generate writes SQL.","html":"https://okm.omqkhafi.dev/docs/define/config/migrations","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/migrations.md"},{"slug":"define/config/namespace","title":"Namespace","description":"namespace is the Postgres schema this catalog owns.","html":"https://okm.omqkhafi.dev/docs/define/config/namespace","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/namespace.md"},{"slug":"define/config/out","title":"Out","description":"out is where okm build writes the catalog.","html":"https://okm.omqkhafi.dev/docs/define/config/out","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/out.md"},{"slug":"define/config/pooler","title":"Pooler","description":"allowPooler skips the pooler-host refusal.","html":"https://okm.omqkhafi.dev/docs/define/config/pooler","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/pooler.md"},{"slug":"define/config/roles","title":"Roles","description":"roles names migration, app, and optional reporting grants.","html":"https://okm.omqkhafi.dev/docs/define/config/roles","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/roles.md"},{"slug":"define/config/schema","title":"Schema","description":"schema is required. okm loads this file.","html":"https://okm.omqkhafi.dev/docs/define/config/schema","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/schema.md"},{"slug":"define/config/tables","title":"Tables","description":"tables is a directory okm check reads for orphan table files.","html":"https://okm.omqkhafi.dev/docs/define/config/tables","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/tables.md"},{"slug":"define/config/timeouts","title":"Timeouts","description":"timeouts sets lock_timeout and statement_timeout for apply.","html":"https://okm.omqkhafi.dev/docs/define/config/timeouts","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/config/timeouts.md"},{"slug":"define/connect","title":"Overview","description":"connect() opens the client. The first argument is the target. schema is required.","html":"https://okm.omqkhafi.dev/docs/define/connect","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect.md"},{"slug":"define/connect/check","title":"Check","description":"The first connection checks the server, the catalog hash, and the floor.","html":"https://okm.omqkhafi.dev/docs/define/connect/check","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/check.md"},{"slug":"define/connect/drivers","title":"Drivers","description":"Import connect from the driver you installed.","html":"https://okm.omqkhafi.dev/docs/define/connect/drivers","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/drivers.md"},{"slug":"define/connect/errors","title":"Errors","description":"errors.http sets the statuses OkmError.toHttp uses.","html":"https://okm.omqkhafi.dev/docs/define/connect/errors","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/errors.md"},{"slug":"define/connect/generators","title":"Generators","description":"generators replaces a built-in client generator by name.","html":"https://okm.omqkhafi.dev/docs/define/connect/generators","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/generators.md"},{"slug":"define/connect/observers","title":"Observers","description":"hookm is a list of read-only observers.","html":"https://okm.omqkhafi.dev/docs/define/connect/observers","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/observers.md"},{"slug":"define/connect/otel","title":"OpenTelemetry","description":"okmodel/otel turns the existing observers into db.* spans.","html":"https://okm.omqkhafi.dev/docs/define/connect/otel","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/otel.md"},{"slug":"define/connect/session","title":"Session","description":"Pool size, prepare mode, TLS, search path, and deadlines.","html":"https://okm.omqkhafi.dev/docs/define/connect/session","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/session.md"},{"slug":"define/connect/target","title":"Target","description":"A string opens a pool. A pool from open is reused.","html":"https://okm.omqkhafi.dev/docs/define/connect/target","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/target.md"},{"slug":"define/connect/topology","title":"Topology","description":"{ primary, replicas } opens one pool per endpoint.","html":"https://okm.omqkhafi.dev/docs/define/connect/topology","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/connect/topology.md"},{"slug":"define/schema","title":"Overview","description":"schema() compiles the tables into one catalog. Each option is a page.","html":"https://okm.omqkhafi.dev/docs/define/schema","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema.md"},{"slug":"define/schema/casing","title":"Casing","description":"The SQL name of a camelCase field.","html":"https://okm.omqkhafi.dev/docs/define/schema/casing","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/casing.md"},{"slug":"define/schema/catalogs","title":"Several catalogs","description":"Two catalogs on one database. external() keeps a table the other catalog owns.","html":"https://okm.omqkhafi.dev/docs/define/schema/catalogs","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/catalogs.md"},{"slug":"define/schema/codecs","title":"Codecs","description":"The TypeScript value. The SQL type stays the same.","html":"https://okm.omqkhafi.dev/docs/define/schema/codecs","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/codecs.md"},{"slug":"define/schema/defaults","title":"Id default","description":"What a bare t.id() means.","html":"https://okm.omqkhafi.dev/docs/define/schema/defaults","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/defaults.md"},{"slug":"define/schema/extensions","title":"Extensions","description":"Extension definitions. schema() does not install them.","html":"https://okm.omqkhafi.dev/docs/define/schema/extensions","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/extensions.md"},{"slug":"define/schema/functions","title":"Functions","description":"Routines the catalog stores.","html":"https://okm.omqkhafi.dev/docs/define/schema/functions","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/functions.md"},{"slug":"define/schema/min-postgres","title":"Minimum Postgres","description":"minPostgres is the oldest major this schema runs on. Omitted means 15.","html":"https://okm.omqkhafi.dev/docs/define/schema/min-postgres","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/min-postgres.md"},{"slug":"define/schema/tables","title":"Tables","description":"The list of tables. A reference names one of them.","html":"https://okm.omqkhafi.dev/docs/define/schema/tables","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/tables.md"},{"slug":"define/schema/tenancy","title":"Tenancy","description":"Tenant keys on every table that does not opt out.","html":"https://okm.omqkhafi.dev/docs/define/schema/tenancy","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/tenancy.md"},{"slug":"define/schema/traits","title":"Traits","description":"Columns applied to every table that does not opt out.","html":"https://okm.omqkhafi.dev/docs/define/schema/traits","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/traits.md"},{"slug":"define/schema/triggers","title":"Triggers","description":"Triggers. Identity is the table plus the name.","html":"https://okm.omqkhafi.dev/docs/define/schema/triggers","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/triggers.md"},{"slug":"define/schema/types","title":"Row types","description":"How row types are produced.","html":"https://okm.omqkhafi.dev/docs/define/schema/types","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/types.md"},{"slug":"define/schema/validation","title":"Validation","description":"Turns rules on for the schema. schema() does not run them.","html":"https://okm.omqkhafi.dev/docs/define/schema/validation","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/validation.md"},{"slug":"define/schema/views","title":"Views","description":"Views and materialized views.","html":"https://okm.omqkhafi.dev/docs/define/schema/views","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/schema/views.md"},{"slug":"define/table","title":"Overview","description":"table() stores the columns. The key comes first, then each data type, then the options.","html":"https://okm.omqkhafi.dev/docs/define/table","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table.md"},{"slug":"define/table/checks","title":"Checks","description":"A check is named SQL.","html":"https://okm.omqkhafi.dev/docs/define/table/checks","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/checks.md"},{"slug":"define/table/columns","title":"Columns","description":"Each field is a data type. The builder name is that type.","html":"https://okm.omqkhafi.dev/docs/define/table/columns","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/columns.md"},{"slug":"define/table/defaults","title":"Defaults","description":"Omitted, the column is required and not null.","html":"https://okm.omqkhafi.dev/docs/define/table/defaults","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/defaults.md"},{"slug":"define/table/filters","title":"Filters","description":"filters() allowlists what a caller may send.","html":"https://okm.omqkhafi.dev/docs/define/table/filters","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/filters.md"},{"slug":"define/table/indexes","title":"Indexes","description":"indexes receives column handles and returns an array of index calls.","html":"https://okm.omqkhafi.dev/docs/define/table/indexes","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/indexes.md"},{"slug":"define/table/keys","title":"Keys","description":"One table has one primary key.","html":"https://okm.omqkhafi.dev/docs/define/table/keys","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/keys.md"},{"slug":"define/table/names","title":"Names","description":"The field name is the TypeScript name.","html":"https://okm.omqkhafi.dev/docs/define/table/names","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/names.md"},{"slug":"define/table/presets","title":"Presets","description":"A preset is a named refinement you call on the table.","html":"https://okm.omqkhafi.dev/docs/define/table/presets","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/presets.md"},{"slug":"define/table/queries","title":"Queries","description":"find returns a list and needs a limit, or .all(reason).","html":"https://okm.omqkhafi.dev/docs/define/table/queries","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/queries.md"},{"slug":"define/table/reference-rows","title":"Required rows","description":"Rows the application expects to find, inserted when the key is missing.","html":"https://okm.omqkhafi.dev/docs/define/table/reference-rows","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/reference-rows.md"},{"slug":"define/table/references","title":"References","description":"references() points a column at another table.","html":"https://okm.omqkhafi.dev/docs/define/table/references","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/references.md"},{"slug":"define/table/relations","title":"Relations","description":"relations names edges. schema() resolves the foreign key.","html":"https://okm.omqkhafi.dev/docs/define/table/relations","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/relations.md"},{"slug":"define/table/shape","title":"Shape","description":"array() wraps a scalar. picklist() narrows a string column. enum() creates a Postgres type.","html":"https://okm.omqkhafi.dev/docs/define/table/shape","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/shape.md"},{"slug":"define/table/tenancy","title":"Tenancy","description":"Schema tenancy adds the key to every table.","html":"https://okm.omqkhafi.dev/docs/define/table/tenancy","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/tenancy.md"},{"slug":"define/table/traits","title":"Traits","description":"trait() adds columns. The schema list is the default. A table adds its own, or opts out.","html":"https://okm.omqkhafi.dev/docs/define/table/traits","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/traits.md"},{"slug":"define/table/validation","title":"Validation","description":"A field's rules live in one place. They run when validation is enabled.","html":"https://okm.omqkhafi.dev/docs/define/table/validation","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/validation.md"},{"slug":"define/table/visibility","title":"Visibility","description":"Three flags. They do not change the SQL type.","html":"https://okm.omqkhafi.dev/docs/define/table/visibility","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/define/table/visibility.md"},{"slug":"reference/cli","title":"CLI","description":"okm reads okmodel.config.ts. okmodel is the same program.","html":"https://okm.omqkhafi.dev/docs/reference/cli","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/cli.md"},{"slug":"reference/environment-variables","title":"Environment Variables","description":"connect and defineConfig do not read the environment. okm reads OKM_DEBUG. Local Postgres reads POSTGRES_VERSION and REQUIRE_DOCKER.","html":"https://okm.omqkhafi.dev/docs/reference/environment-variables","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/environment-variables.md"},{"slug":"reference/errors","title":"Errors","description":"OkmError carries a kind, a category, and a code. okm doctor prints each OKM code.","html":"https://okm.omqkhafi.dev/docs/reference/errors","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/errors.md"},{"slug":"reference/github-action","title":"GitHub Action","description":"The official action posts the migration plan on a pull request and can apply a preview database.","html":"https://okm.omqkhafi.dev/docs/reference/github-action","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/github-action.md"},{"slug":"reference/okid","title":"OKID","description":"okid() is a client generator. The id column is text with collation C.","html":"https://okm.omqkhafi.dev/docs/reference/okid","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/okid.md"},{"slug":"reference/schema-api","title":"Schema API","description":"describe() and buildCatalog() on okmodel/migrate turn a schema into JSON and back.","html":"https://okm.omqkhafi.dev/docs/reference/schema-api","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/schema-api.md"},{"slug":"reference/type-change","title":"Type change","description":"A type change that rewrites the table is five migrations, not one ALTER TYPE.","html":"https://okm.omqkhafi.dev/docs/reference/type-change","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/reference/type-change.md"},{"slug":"start","title":"Let's start","description":"Install a driver, define the table, then push and connect.","html":"https://okm.omqkhafi.dev/docs/start","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/start.md"},{"slug":"start/basic-usage","title":"Basic Usage","description":"Each call on the client: insert, find, one, count, exists, update, and delete.","html":"https://okm.omqkhafi.dev/docs/start/basic-usage","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/start/basic-usage.md"},{"slug":"start/from-drizzle","title":"From Drizzle","description":"okm import drizzle writes okmodel table files from a Drizzle schema.","html":"https://okm.omqkhafi.dev/docs/start/from-drizzle","markdown":"https://okm.omqkhafi.dev/llms.mdx/docs/start/from-drizzle.md"}]}