Skip to content

Conversation

@s3inlc
Copy link
Member

@s3inlc s3inlc commented Nov 14, 2025

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 isMapping is set for this model. The model still remains named User, but for all queries the DBA translates it to htp_User in the actual query strings.

Example 2: In the Table HealthCheckAgent, the column end is prefixed to avoid keyword issues. In this case dba_mapping is set in the model features list. In the model the column is still named end, but for all queries in the DBA translates it to htp_endin the actual query strings.

Copy link

Copilot AI left a 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.

@s3inlc s3inlc requested a review from jessevz November 14, 2025 22:42
@s3inlc s3inlc marked this pull request as ready for review November 14, 2025 22:42
@s3inlc s3inlc merged commit 0720654 into dev Nov 26, 2025
2 checks passed
@s3inlc s3inlc deleted the dba-mapping-rework branch November 26, 2025 11:02
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.

3 participants