Project

General

Profile

Actions

Feature #12800

closed

Automated scan for database schema validity

Added by Boone Gorges almost 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
-
Category name:
Internal Tools and Workflow
Target version:
Start date:
2020-05-13
Due date:
% Done:

0%

Estimated time:
Deployment actions:

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

Related to CUNY Academic Commons - Feature #12598: Investigate and remediate database tables without a primary keyResolvedBoone Gorges2020-03-31

Actions
Actions #1

Updated by Boone Gorges almost 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.

Actions #2

Updated by Boone Gorges almost 4 years ago

  • Related to Feature #12598: Investigate and remediate database tables without a primary key added
Actions #3

Updated by Boone Gorges almost 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.

Actions #4

Updated by Boone Gorges almost 4 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF