Project

General

Profile

Feature #12800

Automated scan for database schema validity

Added by Boone Gorges over 1 year ago. Updated over 1 year 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:

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 keyResolved2020-03-31

History

#1 Updated by Boone Gorges over 1 year 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.

#2 Updated by Boone Gorges over 1 year ago

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

#3 Updated by Boone Gorges over 1 year 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.

#4 Updated by Boone Gorges over 1 year ago

  • Status changed from New to Resolved

Also available in: Atom PDF