-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add character settings to MySQL database creation #3
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
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant MittwaldApi
participant CreateMySqlDatabase
participant CharacterSettings
Caller->>MittwaldApi: create()
MittwaldApi->>CreateMySqlDatabase: instantiate
MittwaldApi->>CharacterSettings: instantiate with charset, collation
MittwaldApi->>CreateMySqlDatabase: withCharacterSettings(CharacterSettings)
MittwaldApi->>CreateMySqlDatabase: proceed with creation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/Database/Manager/MittwaldApi.php (1)
54-63: Consider validating & caching charset/collation values before the API callThe inline
get()calls work, but:
- They are evaluated twice (once for each parameter) and make the expression dense.
- Any invalid or unsupported value will only surface as a runtime API error that is hard to trace.
A small refactor improves readability and allows a future whitelist/validation step:
- database: (new CreateMySqlDatabase( - $this->getFeatureName(), - get('mittwald_project_id'), - get('mittwald_database_version', '8.4') - ))->withCharacterSettings( - new CharacterSettings( - characterSet: get('mittwald_database_character_set', 'utf8mb4'), - collation: get('mittwald_database_collation', 'utf8mb4_unicode_ci') - ) - ), + $charset = get('mittwald_database_character_set', 'utf8mb4'); + $collation = get('mittwald_database_collation', 'utf8mb4_unicode_ci'); + // TODO (optional): validate $charset/$collation against supported lists. + + database: (new CreateMySqlDatabase( + $this->getFeatureName(), + get('mittwald_project_id'), + get('mittwald_database_version', '8.4') + ))->withCharacterSettings( + new CharacterSettings( + characterSet: $charset, + collation: $collation, + ) + ),This is a non-breaking, readability-oriented change; feel free to ignore if you prefer the current inline style.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/Database/Manager/MittwaldApi.php(2 hunks)
🔇 Additional comments (1)
src/Database/Manager/MittwaldApi.php (1)
13-14: Import looks correct – no concerns
CharacterSettingsis required for the new charset/collation logic and the namespace is correct.
Summary by CodeRabbit