Skip to content
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

chore: add extra indexes to calls and unread events tables [WPB-11808] #3084

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CREATE TABLE Call (
CREATE INDEX call_date_index ON Call(created_at);
CREATE INDEX call_conversation_index ON Call(conversation_id);
Copy link
Member

Choose a reason for hiding this comment

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

the conversation ID index is redundant since the PK starts with conversation_id

CREATE INDEX call_caller_index ON Call(caller_id);
CREATE INDEX call_status ON Call(status);

insertCall:
INSERT INTO Call(conversation_id, id, status, caller_id, conversation_type, created_at, type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ CREATE TABLE UnreadEvent (
FOREIGN KEY (id, conversation_id) REFERENCES Message(id, conversation_id) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (id, conversation_id)
);
CREATE INDEX unread_event_conversation ON UnreadEvent(conversation_id);
CREATE INDEX unread_event_date ON UnreadEvent(creation_date);
CREATE INDEX unread_event_type ON UnreadEvent(type);

deleteUnreadEvent:
DELETE FROM UnreadEvent WHERE id = ? AND conversation_id = ?;
Expand Down
4 changes: 4 additions & 0 deletions persistence/src/commonMain/db_user/migrations/89.sqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE INDEX call_status ON Call(status);
CREATE INDEX unread_event_conversation ON UnreadEvent(conversation_id);
CREATE INDEX unread_event_date ON UnreadEvent(creation_date);
CREATE INDEX unread_event_type ON UnreadEvent(type);
Loading