Skip to content

Fix: MySQL JSON columns always need to be DB synced#18

Merged
gwillz merged 1 commit intomasterfrom
fix/db-sync-json
Feb 19, 2026
Merged

Fix: MySQL JSON columns always need to be DB synced#18
gwillz merged 1 commit intomasterfrom
fix/db-sync-json

Conversation

@benno-truevault
Copy link
Copy Markdown
Collaborator

At least in MariaDB 10.6.24, SHOW COLUMNS and information_schema.COLUMNS both show a JSON column as 'longtext', which means the DB sync check thinks the column needs to be synced.

Instead, use information_schema.CHECK_CONSTRAINTS to check for the json_valid(`some_column`) CHECK_CLAUSE, and set the column to be a JSON type if that exists, so it matches the JSON type specified in db_struct.xml

At least in MariaDB 10.6.24, SHOW COLUMNS and information_schema.COLUMNS both
show a JSON column as 'longtext', which means the DB sync check thinks the
column needs to be synced.

Instead, use information_schema.CHECK_CONSTRAINTS to check for the
json_valid(`some_column`) CHECK_CLAUSE, and set the column to be a JSON type
if that exists, so it matches the JSON type specified in db_struct.xml
Copy link
Copy Markdown
Collaborator

@gwillz gwillz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool.

Check constraints were for a long time valid but largely ignored in mysql. I hope one day we can extend db_struct to sync more of these as well.

@gwillz gwillz merged commit 68a8d5e into master Feb 19, 2026
2 checks passed
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.

2 participants