Member Junction
    Preparing search index...

    One-shot transpiler for MemberJunction T-SQL → PostgreSQL via the MJ sqlglot dialect (mj_postgres.py). Unlike SqlGlotClient (a long-lived FastAPI microservice for generic dialect conversion), this invokes the dialect script directly per call — deterministic, no server lifecycle, suited to CLI batch conversion where each migration is transpiled exactly once.

    The dialect's contract: every input statement is either emitted as PostgreSQL or reported in unhandled — never silently dropped.

    const transpiler = new MJPostgresTranspiler({ extraBitColumns: bitCols });
    const result = await transpiler.transpile(keptTsql);
    // result.sql → PG statements; result.unhandled → gaps to surface
    Index

    Constructors

    Methods

    • Extend the cross-file BIT/BOOLEAN registry after construction.

      The constructor registry is collected from the migration set's own baseline, which declares the tables that set DECLARES — never MJ core's. An Open App migration that seeds __mj.EntityField therefore had no type information for AllowsNull / IsVirtual / IsPrimaryKey, so BIT 0/1 passed through to a PostgreSQL BOOLEAN column and the statement failed with column "X" is of type boolean but expression is of type integer (issue #3839).

      Callers that hold a live PostgreSQL connection — --bake-codegen requires one — can supply the authoritative set from information_schema, which is both complete and correct for the core version actually installed, unlike a checked-in map that goes stale as columns are added.

      Must be called before the first transpile(): the registry file is materialised lazily and cached, so this invalidates that cache to keep late additions honest rather than silently ignored.

      Parameters

      Returns void

    • Collect the BIT/BOOLEAN column registry (Table.Column pairs) declared in the given SQL — used to build the cross-file registry from baselines before transpiling individual migrations.

      Parameters

      • sql: string

      Returns Promise<BitColumnRef[]>

    • Verify the interpreter + sqlglot are available; throws with install guidance if not.

      Returns Promise<void>