Skip to content

Conversation

@GustavoPeixoto
Copy link

I have created ChangeQueuedJobsDataLength migration that is a copy of Utf8mb4Fix, but unwraps the adapter before checking its intance.

@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.18%. Comparing base (0d61cb1) to head (3946df6).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dereuromark
Copy link
Owner

What does this fix? Does this new one collide with existing ones?

@dereuromark dereuromark requested a review from Copilot September 11, 2025 09:11
Copy link
Contributor

Copilot AI left a 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 data and failure_message columns 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) {
Copy link

Copilot AI Sep 11, 2025

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.

Copilot uses AI. Check for mistakes.
]);
$table->update();
} catch (Exception $e) {
Debugger::dump($e->getMessage());
Copy link

Copilot AI Sep 11, 2025

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.

Suggested change
Debugger::dump($e->getMessage());
throw $e;

Copilot uses AI. Check for mistakes.
@GustavoPeixoto
Copy link
Author

GustavoPeixoto commented Sep 11, 2025

What does this fix? Does this new one collide with existing ones?

According to migration 20171013133145_Utf8mb4Fix, in MySQL databases, the text columns data and failure_message should have a length limit of MEDIUM, but they do not. This is because the if condition will never be satisfied, since the MysqlAdapter will be wrapped inside the CakeAdapter.

This PR creates the migration ChangeQueuedJobsDataLength which does the same thing as Utf8mb4Fix, but with the if condition fixed.

@dereuromark
Copy link
Owner

Why not fixing the original file?

@GustavoPeixoto
Copy link
Author

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.

@dereuromark
Copy link
Owner

No you can just remove it from being run in the phinxlog table. And all New users will have it automatically

@GustavoPeixoto
Copy link
Author

GustavoPeixoto commented Sep 11, 2025

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.

@dereuromark
Copy link
Owner

Well, its a bugfix for the existing one. Either way works for me.

@GustavoPeixoto
Copy link
Author

This PR was replaced by #442.

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.

3 participants