Skip to content

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

Merged
pushpak1300 merged 2 commits into
laravel:mainfrom
sulimanbenhalim:fix/mysql-check-constraints-join
Sep 2, 2026
Merged

Join TABLE_CONSTRAINTS for check constraints since MySQL's CHECK_CONSTRAINTS table has no TABLE_NAME column#980
pushpak1300 merged 2 commits 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.

sulimanbenhalim and others added 2 commits August 25, 2026 10:35
…e join for MySQL

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pushpak1300
pushpak1300 merged commit 0cdb565 into laravel:main Sep 2, 2026
23 checks passed
@sulimanbenhalim
sulimanbenhalim deleted the fix/mysql-check-constraints-join branch September 2, 2026 15:06
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