Skip to content

Join TABLE_CONSTRAINTS for check constraints since MySQL's CHECK_CONSTRAINTS table has no TABLE_NAME column - #980

Open
sulimanbenhalim wants to merge 1 commit into
laravel:mainfrom
sulimanbenhalim:fix/mysql-check-constraints-join
Open

Join TABLE_CONSTRAINTS for check constraints since MySQL's CHECK_CONSTRAINTS table has no TABLE_NAME column#980
sulimanbenhalim wants to merge 1 commit into
laravel:mainfrom
sulimanbenhalim:fix/mysql-check-constraints-join

Conversation

@sulimanbenhalim

Copy link
Copy Markdown
Contributor

the database-schema tool returns empty check_constraints for every table on MySQL. MySQL's information_schema.CHECK_CONSTRAINTS has no TABLE_NAME column (MariaDB's does), so AND TABLE_NAME = ? throws Unknown column, the catch swallows it, and every table reports zero constraints.

fix joins information_schema.TABLE_CONSTRAINTS to map each constraint to its table, filtered to CONSTRAINT_TYPE = CHECK. works on both engines.

checked on real servers: mysql:8.0.46 goes from [] to the actual constraints for that table (and only that table), mariadb:11 returns the same rows before and after.

re-file of #968, reviewed and re-tested individually.

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