Skip to content

Conversation

@locene
Copy link

@locene locene commented Jun 4, 2025

When generating MariaDB models with this project, JSON type columns are incorrectly defined as string instead of object, which prevents the models from taking full advantage of the correct data type and its associated benefits.

Given that the JSON type in MariaDB is essentially an alias for LONGTEXT, the key differentiator is the inclusion of the JSON_VALID CHECK constraint (reference: https://mariadb.com/kb/en/json/). To address this, I modified the DialectMariaDB.ts file to inspect LONGTEXT columns for the presence of a valid JSON_VALID constraint. If a constraint is found, the column is output as an object; otherwise, it defaults to a string.

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