Skip to content

feat(doctrine): doctrine.table_name_prefix replaces the nowo_http_log_ part of the table name - #38

Merged
HecFranco merged 3 commits into
mainfrom
feat/table-name-prefix
Nov 2, 2026
Merged

HecFranco merged 3 commits into
mainfrom
feat/table-name-prefix

Conversation

@HecFranco

Copy link
Copy Markdown
Contributor

Description

Adds nowo_http_log.doctrine.table_name_prefix (default nowo_http_log_), which replaces the nowo_http_log_ part of the table name. symfony-beacon asked for this and will set http_log_, which gives the table http_log_entry.

  • Prefix, not a full table_name: this follows house style. TaskBoard (task_board_), Wiki (wiki_), TimeTrack, and the ChatKit / SeoKit PRs opened alongside this one all expose a prefix with fixed <name> suffixes. Hosts get one convention for every bundle, and it still works if the bundle gains a second table.
  • The idx_http_log_* index names do not contain nowo_http_log_, so they stay the same under any table_name_prefix. Doctrine derives the request_id unique name (UNIQ_*) from the table name, so it follows the table.
  • BC: doctrine.table_prefix keeps its meaning and is prepended after the replacement. With both defaults the listener is not registered, so every name is byte-identical. The golden tests/Integration/Doctrine/SchemaNamesTest.php builds the schema from the extension config for the default, http_log_ and app_ cases. I also ran it against main code for the default and app_ cases.
  • UPGRADING: rename SQL for MySQL/MariaDB and PostgreSQL. I checked it on throwaway MySQL 8.0 and PostgreSQL 17: the default DDL plus the renames gives the same catalog as a fresh http_log_ install.
  • Docs: CONFIGURATION doctrine section, INSTALLATION, UPGRADING, CHANGELOG Unreleased, spec FR-ORM-002 and code inventory.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the project's coding standards (PSR-12)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit/integration tests pass locally with my changes
  • I have updated the documentation accordingly
  • I have updated docs/CHANGELOG.md if applicable

Testing

Run locally: translation parity, cs-check, rector-dry, phpstan, igor (worker-mode compatible), and PHPUnit with 356 tests at 100% line coverage.

🤖 Generated with Claude Code

…_ part of the table name

New doctrine.table_name_prefix option (default nowo_http_log_) replaces the
nowo_http_log_ part of the table name, e.g. http_log_ gives http_log_entry.
The idx_http_log_* index names do not contain it and stay unchanged;
doctrine.table_prefix keeps prepending to the result.

With the defaults the listener is not registered and the table, index and
unique names are byte-identical (golden SchemaNamesTest). UPGRADING lists the
rename SQL for MySQL/MariaDB and PostgreSQL, checked against MySQL 8.0 and
PostgreSQL 17.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

@coderabbitai review

…able prefixes

- nowo_http_log.doctrine.entry_table publishes the physical table name.
- HttpLogPersonalDataEraserInterface (public service): count and keyset-
  batched delete of entries by user identifier or client IP, through DQL so
  the configured table name always applies.
- table_prefix / table_name_prefix must match /^[a-z][a-z0-9_]*\z/ and may
  not make a generated name longer than 63 characters; checked at compile
  time and in the listener constructor for %env()% values.
- UPGRADING: name clashes, entries dropped during the rename window, host
  SQL on the old name, transactional behaviour per platform.
…table prefixes

- E1: the SQL = only pre-filters (MySQL utf8mb4 *_ci collations also match
  ANA / Ana / ana-acute / ss-sharp-s); each candidate is compared with === in
  PHP before it is counted or deleted, in keyset batches. Test with a
  case-insensitive (NOCASE) fake; also checked on MySQL 8.0
  utf8mb4_0900_ai_ci.
- E2: values containing a NUL byte are rejected (PDO cuts them at NUL).
- E3: IP addresses are compared as logged, without normalisation
  (documented).
- N2: %env()% is rejected for doctrine.table_prefix / table_name_prefix with
  a clear message (fail-closed); docs no longer claim env support.
@HecFranco
HecFranco merged commit 511a1e1 into main Nov 2, 2026
17 checks passed
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.

1 participant