Skip to content

Name the formats of jsonColumnFormat after the columns, and resolve 'auto' by driver - #481

Merged
lehni merged 1 commit into
nextfrom
fix/json-column-format-auto
Oct 15, 2026
Merged

lehni merged 1 commit into
nextfrom
fix/json-column-format-auto

Conversation

@lehni

@lehni lehni commented Oct 15, 2026 •

Copy link
Copy Markdown

jsonColumnFormat now names the kind of column that holds the JSON attributes:

  • 'auto' (default): 'json' on the PostgreSQL drivers, 'text' on SQLite and SQL Server, 'mixed' on MySQL and others.
  • 'json': json / jsonb columns that the driver returns parsed; never parsed again (was 'parsed').
  • 'text': text columns holding JSON; parsed strictly, invalid JSON throws.
  • 'mixed': text columns holding JSON or plain text; valid JSON is parsed, other strings are kept.

A PostgreSQL text column holding JSON mixed with plain text had no fitting format before: the default returned the JSON as strings, and 'text' threw on the plain text. On SQLite and SQL Server, a string that isn't valid JSON in a JSON attribute now throws where 3.x kept it; 'mixed' keeps it. MySQL stays as in 3.x: mysql2 returns json columns parsed while MariaDB stores JSON as text, which knex can't tell apart. The migration guide leads with a jsonb migration that keeps plain text rows.

@lehni
lehni marked this pull request as draft October 15, 2026 21:34
@lehni
lehni force-pushed the fix/json-column-format-auto branch from c89e702 to aa4dd4c Compare October 15, 2026 21:48
@lehni lehni changed the title Let jsonColumnFormat 'auto' parse JSON text leniently on PostgreSQL too Name the formats of jsonColumnFormat after the columns, and resolve 'auto' by driver Oct 15, 2026
@lehni
lehni force-pushed the fix/json-column-format-auto branch from aa4dd4c to 7dc0e33 Compare October 15, 2026 21:51
@lehni
lehni marked this pull request as ready for review October 15, 2026 21:55
@lehni
lehni merged commit fe6b4da into next Oct 15, 2026
5 checks passed
@lehni
lehni deleted the fix/json-column-format-auto branch October 16, 2026 14:55
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