-
Notifications
You must be signed in to change notification settings - Fork 245
DBA mapping rework #1762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBA mapping rework #1762
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a DBA mapping layer that allows transparent renaming of database tables and columns to avoid SQL keyword conflicts. Tables and columns flagged for mapping are automatically prefixed with "htp_" in actual SQL queries while maintaining their original names in the application code. The User table is renamed to htp_User and the HealthCheckAgent.end column to htp_end.
- Database schema updated to use prefixed names for problematic identifiers
- All model factories now implement
isMapping()method to indicate table-level mapping - Filter, Order, and Group classes refactored to accept factory context for proper name mapping
- Type hints and return types added throughout the DBA layer
Reviewed Changes
Copilot reviewed 113 out of 114 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/dba/AbstractModelFactory.class.php | Core mapping logic with getMappedModelTable() and getMappedModelKey() methods |
| src/dba/models/generator.php | Generator updated to output dba_mapping field in model features |
| src/dba/Filter.class.php, Order.class.php, Group.class.php | Abstract method signatures updated to pass factory context |
| src/dba/*Filter.class.php, OrderFilter.class.php, etc. | All filter implementations updated to use mapped names |
| src/dba/UpdateSet.class.php | Namespace added and updated to use mapping |
| src/dba/Util.class.php | createPrefixedString() simplified and signature updated |
| src/install/hashtopolis.sql | Schema updated with htp_ prefixed names |
| src/install/updates/update_v1.0.0-rainbow4_vx.x.x.php | Migration script to rename existing tables/columns |
| Model Factory/Class files | All models updated with isMapping() method and dba_mapping fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
… into dba-mapping-rework
This change applies an additional concept to the DBA.
In case there are table names or table columns which are an issue for a database system due to a keywords used, the DBA can now transparently map such values to a prefixed name which is only used in the database itself, but is translated to the remaining part of the source code, models and APIs.
Example 1: Table User is renamed to htp_User to avoid keyword issues. In this case the flag
isMappingis set for this model. The model still remains namedUser, but for all queries the DBA translates it tohtp_Userin the actual query strings.Example 2: In the Table HealthCheckAgent, the column
endis prefixed to avoid keyword issues. In this casedba_mappingis set in the model features list. In the model the column is still namedend, but for all queries in the DBA translates it tohtp_endin the actual query strings.