Skip to content

Support extra schemas in Ormin imports#85

Draft
elcritch wants to merge 4 commits into
Araq:masterfrom
elcritch:support-sql-extras
Draft

Support extra schemas in Ormin imports#85
elcritch wants to merge 4 commits into
Araq:masterfrom
elcritch:support-sql-extras

Conversation

@elcritch

@elcritch elcritch commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
  • Extends Ormin’s SQL parser/importer to tolerate common PostgreSQL schema files, including schema-qualified identifiers, DO $$ blocks, generated columns, identity columns, casts, indexes with predicates, triggers, and DML/reference-data statements.
  • Resolves CREATE TYPE ... AS ENUM definitions, including enums declared inside PostgreSQL DO blocks, so qualified enum columns import as dbEnum.
  • Adds PostgreSQL type mappings for jsonb, bigint, int2, and int4.
  • Updates table utility handling so schema-qualified table names are imported and rendered correctly.
  • Adds a generic PostgreSQL regression test covering enum types, jsonb, generated identity, generated expressions, references, indexes, triggers, and insert ... on conflict.

Column and Enum names / values

The generated model now preserves each column’s database
type name and enum values through Attr.typeName and
Attr.validValues, then carries those into query source
metadata as DbType.name and DbType.validValues. This lets
downstream code inspect dbEnum columns with their concrete
Postgres enum labels instead of only seeing the generic
dbEnum kind.

Also adds regression coverage for Postgres schema imports
with enum types.

Testing

  • nim c -r tests/tpostgres_schema_import.nim
  • Used downstream in sam_auth_server against the authoritative PostgreSQL/Supabase schema import path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant