mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
Remove indexes which used accountId as the first param... not faster
This commit is contained in:
parent
1e6b857437
commit
4edbe7652c
|
@ -158,8 +158,7 @@ class Message extends Model
|
||||||
|
|
||||||
@additionalSQLiteConfig:
|
@additionalSQLiteConfig:
|
||||||
setup: ->
|
setup: ->
|
||||||
['CREATE INDEX IF NOT EXISTS MessageListIndex ON Message(account_id, thread_id, date ASC)',
|
['CREATE INDEX IF NOT EXISTS MessageListThreadIndex ON Message(thread_id, date ASC)',
|
||||||
'CREATE INDEX IF NOT EXISTS MessageListThreadIndex ON Message(thread_id, date ASC)',
|
|
||||||
'CREATE INDEX IF NOT EXISTS MessageListDraftIndex ON Message(account_id, draft)',
|
'CREATE INDEX IF NOT EXISTS MessageListDraftIndex ON Message(account_id, draft)',
|
||||||
'CREATE UNIQUE INDEX IF NOT EXISTS MessageDraftIndex ON Message(client_id)',
|
'CREATE UNIQUE INDEX IF NOT EXISTS MessageDraftIndex ON Message(client_id)',
|
||||||
'CREATE UNIQUE INDEX IF NOT EXISTS MessageBodyIndex ON MessageBody(id)']
|
'CREATE UNIQUE INDEX IF NOT EXISTS MessageBodyIndex ON MessageBody(id)']
|
||||||
|
|
|
@ -100,7 +100,7 @@ class Thread extends Model
|
||||||
|
|
||||||
@additionalSQLiteConfig:
|
@additionalSQLiteConfig:
|
||||||
setup: ->
|
setup: ->
|
||||||
['CREATE INDEX IF NOT EXISTS ThreadListIndex ON Thread(account_id, last_message_received_timestamp DESC, id)']
|
['CREATE INDEX IF NOT EXISTS ThreadListIndex ON Thread(last_message_received_timestamp DESC, id)']
|
||||||
|
|
||||||
fromJSON: (json) ->
|
fromJSON: (json) ->
|
||||||
super(json)
|
super(json)
|
||||||
|
|
|
@ -211,7 +211,7 @@ class MessageStore extends NylasStore
|
||||||
loadedThreadId = @_thread.id
|
loadedThreadId = @_thread.id
|
||||||
|
|
||||||
query = DatabaseStore.findAll(Message)
|
query = DatabaseStore.findAll(Message)
|
||||||
query.where(threadId: loadedThreadId, accountId: @_thread.accountId)
|
query.where(threadId: loadedThreadId)
|
||||||
query.include(Message.attributes.body)
|
query.include(Message.attributes.body)
|
||||||
query.then (items) =>
|
query.then (items) =>
|
||||||
# Check to make sure that our thread is still the thread we were
|
# Check to make sure that our thread is still the thread we were
|
||||||
|
|
|
@ -198,8 +198,7 @@ class CategoryMailboxPerspective extends MailboxPerspective
|
||||||
super(other) and _.isEqual(@categories(), other.categories())
|
super(other) and _.isEqual(@categories(), other.categories())
|
||||||
|
|
||||||
threads: =>
|
threads: =>
|
||||||
query = DatabaseStore
|
query = DatabaseStore.findAll(Thread)
|
||||||
.findAll(Thread)
|
|
||||||
.where([Thread.attributes.categories.containsAny(_.pluck(@categories(), 'id'))])
|
.where([Thread.attributes.categories.containsAny(_.pluck(@categories(), 'id'))])
|
||||||
.limit(0)
|
.limit(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue