Uh oh!
There was an error while loading. Please reload this page.
Add table prefix support to TableIdentifier with configurable factory - #156
Conversation
Adds optional prefix and separator parameters to TableIdentifier. When a prefix is set, getTable() and getTableAndSchema() return the prefixed table name (prefix + separator + table), so the prefix flows through all SQL generation unchanged. The separator defaults to '_' and the original name remains available via getUnprefixedTable(). Adds the callable Sql\TableIdentifierFactory, which produces identifiers carrying a preconfigured prefix/separator, and the container factory Container\TableIdentifierFactoryFactory, which reads both from the 'config' service so the prefix can be set once globally (e.g. to create backup_* tables during a migration). Registered in ConfigProvider. Closesphp-db#147
- Updated DDL documentation
Used separator CONST for Factory
Updated documentation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tyrsson
commented
Aug 7, 2026
@simon-mundy where are we on this? I thought this had been merged..... |
tyrsson
commented
Aug 12, 2026
This one is approved but I would like to wait on merging it until the transition to the qa-tools is merged so it can be rebased against it. |
# Conflicts: # src/Sql/TableIdentifier.php # test/unit/Sql/TableIdentifierTest.php
Apply mago formatting to the new TableIdentifier factory classes and tests, declare the container and validation exceptions propagated by TableIdentifierFactoryFactory::__invoke(), and baseline the linter's prefer-test-attribute, assertion-style and literal-named-argument findings for the new test classes, matching the rest of the suite.
Aligns the caller workflow filename and display name with the convention used across the php-db org and prescribed by the phpdb-qa-tools README.
Turn on the qa-tools codecov and mutation-test jobs, which need secrets: inherit and a coverage-php-version to nominate the canonical matrix leg — without the latter no clover artifact is produced and both jobs break. Add infection/infection, infection.json5.dist and a mutation-test composer script. Infection 0.33+ requires PHP ^8.3, so dropping 8.2 is what allows 0.34.x; php constraints in composer.json, mago.toml, the CI matrix and the Docker deployment docs move with it. PHP 8.3 also permits typed class constants, so TableIdentifier::SEPARATOR gains one. min-msi and min-covered-msi are set to 80 against a measured baseline of 86% (2706 mutants, 100% mutation code coverage).
Infection 0.34 added 'mago' to StaticAnalysisToolTypes, so escaped mutants are now re-checked with mago analyze. resources/schema.json still lists only phpstan and debug, but the runtime enum is what validates the config.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
Uh oh!
There was an error while loading. Please reload this page.
Description
Adds optional prefix and separator parameters to TableIdentifier. When a prefix is set, getTable() and getTableAndSchema() return the prefixed table name (prefix + separator + table), so the prefix flows through all SQL generation unchanged. The separator defaults to '_' and the original name remains available via getUnprefixedTable().
Adds the callable Sql\TableIdentifierFactory, which produces identifiers carrying a preconfigured prefix/separator, and the container factory Container\TableIdentifierFactoryFactory, which reads both from the 'config' service so the prefix can be set once globally, registered in ConfigProvider.
Closes#147