Skip to content

Conversation

alexandreferris
Copy link
Member

  • Add type field as string to Conversation.sq
  • Adjusted mappers and database to accommodate new field
  • Adjusted tests

PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

We are not saving the Conversation Type to the database

Causes (Optional)

We were retrieving from the API but never saving into the database.

Solutions

Add new column type into Conversation.sq/Conversation table

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

Notes (Optional)

Due to the SDK not being used in any production environment for now we decided on just adding the new field directly and not doing the migration in this ticket, but rather put out findings and implementations in a document in the Integrations Space for when the time comes for a new migration.

* Add type field as string to Conversation.sq
* Adjusted mappers and database to accommodate new field
* Adjusted tests
@alexandreferris alexandreferris requested a review from a team as a code owner July 11, 2025 14:24
@alexandreferris alexandreferris self-assigned this Jul 11, 2025
Copy link
Contributor

@MarianKijewski MarianKijewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one question regarding enum corresponding to the conversation type.
Other than that looks good to me.

@alexandreferris alexandreferris requested a review from Copilot July 14, 2025 08:59
Copy link

@Copilot 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 type field to the conversation table and updates all layers (model, SQL schema, mappers, storage, and tests) to handle this new column.

  • Introduce a non-null type column in the SQLDelight schema and update insert/update statements.
  • Extend ConversationData with a Type enum and mapping helpers (fromApi, fromString, toString).
  • Update event routing and SQLite storage to read and write the new type field, and adjust tests accordingly.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Conversation.sq Added type TEXT NOT NULL column and included it in insert/update statements.
ConversationData.kt Added Type enum, companion mapping functions, and updated ConversationData constructor.
EventsRouter.kt Populated the new type field from the API response in ConversationData creation.
ConversationSqlLiteStorage.kt Persisted and retrieved the type field in SQLite, encoding/decoding to/from string.
WireEventsTest.kt Updated test fixture to include the new type argument when constructing ConversationData.
Comments suppressed due to low confidence (2)

lib/src/main/sqldelight/com/wire/integrations/jvm/Conversation.sq:8

  • Adding a non-nullable column without a default value or a migration strategy can break existing databases. Consider providing a DEFAULT or planning a migration path to populate this column for existing rows.
  type TEXT NOT NULL,

lib/src/main/kotlin/com/wire/integrations/jvm/persistence/ConversationSqlLiteStorage.kt:43

  • There are no unit tests verifying that the type field is correctly saved to and loaded from SQLite. Consider adding storage layer tests to cover insert and query with various Type values.
            type = conversation.type.toString()

* Remove toString(type) as it was not being used
* Change conversation.type.toString() to `.name` as its default from Enums
@alexandreferris alexandreferris merged commit 300bf84 into main Jul 15, 2025
2 checks passed
@alexandreferris alexandreferris deleted the feat/add_conversation_type_to_db branch July 15, 2025 07:07
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.

2 participants