Feature #12800
closedAutomated scan for database schema validity
0%
Description
Following up on #12598, I'll be working on tools to ensure that incompatible database table schema changes aren't introduced into our codebase.
Related issues
Updated by Boone Gorges over 4 years ago
https://github.com/cuny-academic-commons/cac/commit/f39822996fe5429cca11e1ad0b886cd90166fa2e introduces a framework for doing this kind of scan.
I've introduced a new PHPCS ruleset CAC
. This ruleset includes the PHPCompatibilityWP ruleset (which we were already using) and introduces a custom sniff RequirePrimaryKey. This setup allows us to add more sniffs in the future, both custom and off-the-shelf.
The RequirePrimaryKey sniff looks for strings of the form 'CREATE TABLE' (even those that are concatenated and/or interpolated) and then ensures that they have the text 'PRIMARY KEY' in them. This is not at all a perfect system - it's viable to certain kinds of false positives, and it will almost certainly miss problematic cases. But it's a starting place, and I will continue to work on it.
Updated by Boone Gorges over 4 years ago
- Related to Feature #12598: Investigate and remediate database tables without a primary key added
Updated by Boone Gorges over 4 years ago
I've completed work on this tool for the time being. I'll be sure to monitor the output of this scan before each release and take action as appropriate.