Skip to content

feat: auto-convert camelCase property names to snake_case column names#30

Merged
markshust merged 1 commit intodevelopfrom
feature/camel-to-snake-columns
Apr 14, 2026
Merged

feat: auto-convert camelCase property names to snake_case column names#30
markshust merged 1 commit intodevelopfrom
feature/camel-to-snake-columns

Conversation

@markshust
Copy link
Copy Markdown
Collaborator

Summary

  • Auto-conversion: EntityMetadataFactory now converts camelCase property names to snake_case column names when no explicit name: is provided on #[Column] (e.g., $createdAt -> created_at, $userId -> user_id)
  • Edge cases handled: consecutive caps ($userID -> user_id), leading acronyms ($HTMLParser -> html_parser), single-word properties unchanged
  • Explicit override preserved: #[Column(name: 'custom')] still takes priority
  • Boilerplate removed: ~30 redundant explicit column names removed from production entities across admin-auth, media, webhook, and authentication-token packages
  • FK names improved: now use snake_case (fk_posts_user_id instead of fk_posts_userId)
  • Docs updated: convention documented in database package docs and all tutorials

Breaking change: existing databases with verbatim camelCase column names will need migration or explicit name: overrides.

Test plan

  • New tests for camelCase-to-snake_case conversion edge cases
  • Existing override test updated to use genuinely custom name (not matching auto-conversion)
  • All database package unit tests updated and passing
  • All database package feature tests updated and passing
  • All Repository tests updated and passing (23 isActive refs migrated)
  • All admin-auth, media, webhook, authentication-token entity tests updated and passing
  • Full test suite passing (4462 tests)
  • Standards enforcer run on all changed files
  • Documentation updated across guides, tutorials, and READMEs

🤖 Generated with Claude Code

When a #[Column] attribute has no explicit name: parameter, the property
name is now automatically converted from camelCase to snake_case for the
database column name (e.g., $createdAt -> created_at, $userId -> user_id).

Explicit #[Column(name: 'custom')] overrides still take priority.

All redundant explicit name: parameters removed from production entities
across admin-auth, media, webhook, and authentication-token packages.
Documentation updated with new convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added enhancement New feature or request breaking Introduces a breaking change labels Apr 14, 2026
@markshust markshust merged commit 0764d37 into develop Apr 14, 2026
1 check passed
@markshust markshust deleted the feature/camel-to-snake-columns branch April 14, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant