Skip to content

Conversation

@elliottlawson
Copy link
Owner

@elliottlawson elliottlawson commented Jun 15, 2025

Summary

  • Add UUID column to messages table to match the implementation used for conversations
  • Allows systems to reference messages without exposing database IDs
  • Maintains backward compatibility with existing code

Changes

  • Added migration to add uuid column to messages table
  • Updated Message model to use Laravel's HasUuids trait
  • Configured uniqueIds() method to use the uuid column
  • Updated API documentation to include the new uuid property

Breaking Changes

While this PR does introduce breaking changes, the impact is intended to be minimized by the introduction of a an upgrade command.

  • The goal here is to avoid ending up with a significant amount of migrations in the package. As we're very early in the package's lifecycle, this seems like the least obtrusive approach to maintain that objective.

If you installed Converse before version 0.1.5, run:

php artisan converse:upgrade

This command:

  • Adds the UUID column to your existing messages table
  • Automatically generates UUIDs for all existing messages

Test plan

  • All existing tests pass
  • Code style checks pass with Laravel Pint
  • Migration runs successfully
  • Migration rollback works correctly

Add UUID column to messages table matching the implementation used for conversations. This allows systems to reference messages without exposing database IDs.

- Add migration to add uuid column to messages table
- Update Message model to use HasUuids trait
- Configure uniqueIds() method to use uuid column
- Update API documentation to include uuid property
@netlify
Copy link

netlify bot commented Jun 15, 2025

Deploy Preview for converse-php canceled.

Name Link
🔨 Latest commit 3456780
🔍 Latest deploy log https://app.netlify.com/projects/converse-php/deploys/684e5c3778eec9000875c708

- Move UUID column from separate migration to core messages table migration
- Add converse:upgrade command for existing installations
- Add CHANGELOG.md to document breaking changes
- Update installation docs with upgrade instructions

BREAKING CHANGE: Messages table now includes UUID column by default.
Run `php artisan converse:upgrade` for existing installations.
The converse:upgrade command now:
- Adds the UUID column to the messages table
- Automatically generates UUIDs for all existing messages
- Shows progress bar for large datasets
- Updates documentation to reflect this behavior
- Import Message model directly instead of weird class string usage
- Use chunk() instead of get() to handle potentially millions of messages
- Process messages in batches of 100 for memory safety
- Count total messages upfront for accurate progress bar
- No transaction so command can be resumed if it fails partway
- Use chunkById() for better performance with large datasets
- Use bulk upsert() instead of individual updates
- Use Str::uuid()->toString() for clarity
- Batch progress bar updates for better performance
@elliottlawson elliottlawson merged commit f00a208 into master Jun 15, 2025
11 checks passed
@elliottlawson elliottlawson deleted the feature/add-uuid-to-messages branch June 15, 2025 05:40
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