-
Notifications
You must be signed in to change notification settings - Fork 334
WPB-22811 migrate conversation codes table to postgres #4961
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
WPB-22811 migrate conversation codes table to postgres #4961
Conversation
9aac6c1 to
337dd3c
Compare
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 migrates the conversation codes table from Cassandra to PostgreSQL, following the same pattern used for the conversation table migration. The implementation includes a PostgreSQL store, dual-write capability during migration, and a background worker to migrate existing data.
Changes:
- Added PostgreSQL implementation for conversation codes storage with appropriate schema and indexes
- Implemented dual-write pattern to write to both Cassandra and PostgreSQL during migration
- Created background worker migration task to migrate existing conversation codes from Cassandra to PostgreSQL
- Updated configuration to allow choosing storage backend (Cassandra, PostgreSQL, or migration mode)
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| postgres-schema.sql | Added conversation_codes table schema and indexes |
| libs/wire-subsystems/postgres-migrations/20260115150600-conversation-codes.sql | PostgreSQL migration script creating conversation_codes table |
| libs/wire-subsystems/src/Wire/CodeStore/Postgres.hs | PostgreSQL implementation of CodeStore operations |
| libs/wire-subsystems/src/Wire/CodeStore/DualWrite.hs | Dual-write interpreter for migration phase |
| libs/wire-subsystems/src/Wire/CodeStore/Migration.hs | Migration logic to copy codes from Cassandra to PostgreSQL |
| libs/wire-subsystems/src/Wire/Migration.hs | Shared migration utilities extracted from conversation migration |
| libs/wire-subsystems/src/Wire/CodeStore/Scope.hs | Added PostgreSQL marshalling instances for Scope |
| libs/wire-api/src/Wire/API/PostgresMarshall.hs | Added marshalling instances for Code.Key, Code.Value, and Password |
| services/galley/src/Galley/App.hs | Added interpreter selection based on configuration |
| services/background-worker/src/Wire/PostgresMigrations.hs | Added conversation codes migration worker |
| services/background-worker/src/Wire/BackgroundWorker.hs | Integrated conversation codes migration into worker lifecycle |
| integration/test/Test/Migration/ConversationCodes.hs | Integration tests for conversation codes migration |
| charts/*/values.yaml | Added conversationCodes configuration option |
| docs/src/developer/reference/config-options.md | Updated documentation for migration configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
libs/wire-subsystems/postgres-migrations/20260115150600-conversation-codes.sql
Show resolved
Hide resolved
libs/wire-subsystems/postgres-migrations/20260115150600-conversation-codes.sql
Show resolved
Hide resolved
libs/wire-subsystems/test/unit/Wire/Roundtrip/PostgresMarshallSpec.hs
Outdated
Show resolved
Hide resolved
akshaymankar
left a comment
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.
Thanks for the docs, they look good. I'd say let's move the instances to the right place, other feedback is not so important.
libs/wire-subsystems/postgres-migrations/20260115150600-conversation-codes.sql
Outdated
Show resolved
Hide resolved
akshaymankar
left a comment
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.
![]()
08c3234 to
b49e039
Compare
b49e039 to
4f14d6f
Compare
https://wearezeta.atlassian.net/browse/WPB-22811
Checklist
changelog.d