iya-sts
    Preparing search index...

    Reads both DDL copies and emits the SQL file unchanged.

    Index
    • Throws when after drops or retypes something before has.

      Parameters

      • before: PgModel

        the earlier model

      • after: PgModel

        the candidate

      Returns void

    • Writes the lookup links onto columns the script actually has.

      Parameters

      • tables: PgTable[]

        parsed tables

      • gaps: PgGap[]

        the gap list

      Returns void

    • Builds a model from texts the caller already has. Tests pass a fixture here without loading the driver.

      Parameters

      • sql: string

        the schema script

      • driver: any

        the driver's exported lists, or null in a fixture

      • mariadbSource: string

        the MariaDB module source, or empty

      Returns PgModel

      the model

    • One column piece. A piece that does not start with an identifier is not a column.

      Parameters

      • piece: string

        trimmed SQL

      Returns PgColumn

      the column, or null

    • The SQL file, unchanged.

      Parameters

      • model: PgModel

        a model from read() or build()

      Returns string

      the file bytes stored on the model

    • PostgreSQL tables whose name the MariaDB file does not use.

      Parameters

      • tables: PgTable[]

        parsed PostgreSQL tables

      • source: string

        schema_mariadb.js text

      • gaps: PgGap[]

        the gap list

      Returns void

    • The index of the parenthesis matching open.

      Parameters

      • sql: string

        the script

      • open: number

        the index of (

      Returns number

      the index of ), or -1

    • Collapses whitespace. The two DDL copies differ only by it.

      Parameters

      • statement: string

        one statement

      Returns string

      the comparable text

    • Checks one row against the column types the DDL states. unknown accepts any JSON value, which is what an unmapped type and jsonb are here. This does not replace the driver.

      Parameters

      • model: PgModel

        the model

      • tableName: string

        the table

      • value: unknown

        the candidate row

      Returns { errors: string[]; ok: boolean }

      whether it matches

    • Finds each table's statement, so the model can say where in the script it runs and what follows its closing parenthesis. A table rebuilt from its columns that is not the script's statement is a gap.

      Parameters

      • tables: PgTable[]

        parsed tables

      • statements: string[]

        the script's statements

      • gaps: PgGap[]

        the gap list

      Returns void

    • A quoted span, with doubled quotes kept.

      Parameters

      • body: string

        the text

      • start: number

        the opening quote

      • quote: string

        ' or "

      Returns { next: number; text: string }

      the span including quotes, and the index after it

    • Reads the schema file and the driver's statement lists.

      Parameters

      • root: string

        the package root

      Returns PgModel

      the model. sql is the file's bytes.

    • One table's CREATE statement, from its parts.

      Parameters

      • table: PgTable

        the table

      Returns string

      the statement, whitespace normalized

    • Problems that would drop or retype a table or a column. Empty when after still has everything before has, with the same type token.

      Parameters

      • before: PgModel

        the earlier model

      • after: PgModel

        the model a later emit would write

      Returns string[]

      the problems

    • Splits on commas that are not inside parentheses or quotes.

      Parameters

      • body: string

        a CREATE TABLE body

      Returns string[]

      the pieces, untrimmed

    • The type tokens at the start of a column's remainder.

      Parameters

      • rest: string

        the SQL after the column name

      Returns string

      the type, or unknown when it does not match

    • Normalized statements, comments and psql meta-commands removed. Semicolons inside dollar quotes stay inside the statement. This is the same whitespace rule as tests/postgres_schema.js.

      Parameters

      • sql: string

        the script

      Returns string[]

      the statements

    • One table body.

      Parameters

      • name: string

        the table

      • raw: string

        the text inside the parentheses

      • gaps: PgGap[]

        the gap list

      Returns PgTable

      the table

    • Every CREATE TABLE, with columns split at depth zero.

      Parameters

      • sql: string

        the script

      • gaps: PgGap[]

        the gap list

      Returns PgTable[]

      the tables, in script order

    • Copies the driver's lists and records a gap wherever the script comparison used by tests/postgres_schema.js would fail.

      Parameters

      • model: PgModel

        the model being filled

      • driver: any

        persistence_postgres.js exports

      • statements: string[]

        normalized script statements

      • gaps: PgGap[]

        the gap list

      Returns void

    • A Zod schema for one SQL type token.

      Parameters

      • sqlType: string

        the type from the column

      Returns any

      the schema