Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/stream_chat_persistence/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

- Read only the thread replies matching the `PaginationParams` from DB when calling `MessageDao.getThreadMessagesByParentId` instead of reading all replies for the thread and applying pagination in memory.
- Read only the messages matching the `PaginationParams` from DB when calling `PinnedMessageDao.getMessagesByCid` instead of reading all pinned messages for the channel and applying pagination in memory.
- Add indices on the `channel_cid` column on the `Messages`, `Members`, and `Reads` tables to improve read times on large databases.
- Add indices on the `message_id` column on the `Reactions` table to improve read times on large databases.

🐞 Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DriftChatDatabase extends _$DriftChatDatabase {

// you should bump this number whenever you change or add a table definition.
@override
int get schemaVersion => 30;
int get schemaVersion => 31;

// Store DateTime as ISO-8601 text to preserve sub-second precision.
@override
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:stream_chat_persistence/src/entity/channels.dart';

/// Represents a [Members] table in [DriftChatDatabase].
@DataClassName('MemberEntity')
@TableIndex(name: 'idx_members_channel_cid', columns: {#channelCid})
class Members extends Table {
/// The interested user id
TextColumn get userId => text()();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:stream_chat_persistence/src/entity/channels.dart';

/// Represents a [Messages] table in [DriftChatDatabase].
@DataClassName('MessageEntity')
@TableIndex(name: 'idx_messages_channel_cid', columns: {#channelCid})
class Messages extends Table {
/// The message id
TextColumn get id => text()();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:stream_chat_persistence/src/entity/messages.dart';

/// Represents a [Reactions] table in [DriftChatDatabase].
@DataClassName('ReactionEntity')
@TableIndex(name: 'idx_reactions_message_id', columns: {#messageId})
class Reactions extends Table {
/// The id of the user that sent the reaction
TextColumn get userId => text()();
Expand Down
1 change: 1 addition & 0 deletions packages/stream_chat_persistence/lib/src/entity/reads.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:stream_chat_persistence/src/entity/channels.dart';

/// Represents a [Reads] table in [DriftChatDatabase].
@DataClassName('ReadEntity')
@TableIndex(name: 'idx_reads_channel_cid', columns: {#channelCid})
class Reads extends Table {
/// Date of the read event
DateTimeColumn get lastRead => dateTime()();
Expand Down
Loading