typeorm/typeorm · error · TypeORMError

sqlit driver does not support change comment.

Error message

sqlit driver does not support change comment.

What it means

changeTableComment() on the SQLite query runner is a hard stub — SQLite does not support table comments in metadata (comments in SQLite are only allowed as SQL comments inside DDL and are not persisted as schema metadata). Any call throws. Note: the message contains a typo ('sqlit') in source.

Source

Thrown at src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts:2477

                : target
        return tableName
            .replaceAll(/^\.+|\.+$/g, "")
            .split(".")
            .map((i) => (disableEscape ? i : this.driver.escape(i)))
            .join(".")
    }

    /**
     * Change table comment.
     *
     * @param tableOrName
     * @param comment
     */
    changeTableComment(
        tableOrName: Table | string,
        comment?: string,
    ): Promise<void> {
        throw new TypeORMError(`sqlit driver does not support change comment.`)
    }
}

View on GitHub (pinned to 04ff4daedc)

Solutions

  1. Gate the call on driver type: skip for sqlite/sqljs/better-sqlite3/expo/react-native.
  2. Use SQL comments inside a custom DDL string if you need documentation in source, accepting they are not stored metadata.
  3. Drop the comment from entity metadata when targeting SQLite.
  4. Split comment-related migrations into a Postgres/MySQL-only set.

Example fix

// before
await queryRunner.changeTableComment("user", "Application users");
// after
if (["postgres","mysql","mariadb"].includes(dataSource.options.type)) {
  await queryRunner.changeTableComment("user", "Application users");
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (['postgres','mysql','mariadb'].includes(dataSource.options.type)) {
  await queryRunner.changeTableComment(table, comment);
}

Type guard

const supportsTableComment = (type: string) =>
  ['postgres','mysql','mariadb','oracle','mssql'].includes(type);

Try / catch

try { await queryRunner.changeTableComment(t, c); }
catch (e) { if (/does not support change comment/.test((e as Error).message)) { /* skip on sqlite */ } else throw e; }

Prevention

When it happens

Trigger: Calling queryRunner.changeTableComment(table, comment) on a SQLite DataSource; running a migration or entity subscriber that sets table comments without driver-awareness.

Common situations: Cross-driver code that sets comments for Postgres/MySQL and inadvertently runs against SQLite; entity metadata with comment fields synchronized via schema sync on SQLite; sharing migration logic across drivers.

Related errors


AI-assisted analysis of typeorm/typeorm@04ff4daedc (2026-08-03). Data as JSON: /data/errors/6d0d6d7b2d3db450.json. Report an issue: GitHub.