-
Notifications
You must be signed in to change notification settings - Fork 137
unwrap the adapter before checking its instance #441
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
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## cake4 #441 +/- ##
=========================================
Coverage 72.18% 72.18%
Complexity 701 701
=========================================
Files 40 40
Lines 2567 2567
=========================================
Hits 1853 1853
Misses 714 714 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
What does this fix? Does this new one collide with existing ones? |
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.
Pull Request Overview
This PR adds a new database migration ChangeQueuedJobsDataLength that modifies the queued_jobs table to increase column sizes and ensure UTF-8 encoding for MySQL databases. The migration improves upon existing patterns by unwrapping adapter instances before type checking.
- Adds migration to change
dataandfailure_messagecolumns to medium text with UTF-8 encoding - Implements adapter unwrapping logic to properly detect MySQL adapters even when wrapped
- Includes MySQL-specific checks to avoid running on incompatible database types
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| 'collation' => 'utf8mb4_unicode_ci', | ||
| ]); | ||
| $table->update(); | ||
| } catch (Exception $e) { |
Copilot
AI
Sep 11, 2025
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.
The catch block uses the generic Exception class but the Exception class is not imported. This should be \Exception or add use Exception; to the imports.
| ]); | ||
| $table->update(); | ||
| } catch (Exception $e) { | ||
| Debugger::dump($e->getMessage()); |
Copilot
AI
Sep 11, 2025
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.
Using Debugger::dump() in a migration is inappropriate for production code. Consider using proper logging or rethrowing the exception with more context instead of dumping debug output.
| Debugger::dump($e->getMessage()); | |
| throw $e; |
According to migration 20171013133145_Utf8mb4Fix, in MySQL databases, the text columns This PR creates the migration |
|
Why not fixing the original file? |
Because it would be necessary to rollback all migrations between the last one and the fixed migration to apply the fix. |
|
No you can just remove it from being run in the phinxlog table. And all New users will have it automatically |
|
Ok, I can do that if you prefer, but isn't that bad practice? Since migrations are supposed to run in the sequence they were created? Also, other current users, using MySQL like me, will need to be aware of this fix to manually remove it from phinxlog. |
|
Well, its a bugfix for the existing one. Either way works for me. |
|
This PR was replaced by #442. |
I have created ChangeQueuedJobsDataLength migration that is a copy of Utf8mb4Fix, but unwraps the adapter before checking its intance.