Skip to content
Snippets Groups Projects
Commit c8f6e154 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Replace index commands from ChatSubscription

parent 23148082
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,13 @@ RocketChat.models.Subscriptions = new class asd extends RocketChat.models._Base
constructor: ->
@model = new Meteor.Collection 'rocketchat_subscription'
@tryEnsureIndex { 'rid': 1, 'u._id': 1 }, { unique: 1 }
@tryEnsureIndex { 'u._id': 1, 'name': 1, 't': 1 }, { unique: 1 }
@tryEnsureIndex { 'open': 1 }
@tryEnsureIndex { 'alert': 1 }
@tryEnsureIndex { 'unread': 1 }
@tryEnsureIndex { 'ts': 1 }
# FIND
findByUserId: (userId, options) ->
......
......@@ -3,13 +3,6 @@ Meteor.startup ->
try ChatRoom._ensureIndex { 'name': 1 }, { unique: 1, sparse: 1 } catch e then console.log e
try ChatRoom._ensureIndex { 'u._id': 1 } catch e then console.log e
try ChatSubscription._ensureIndex { 'rid': 1, 'u._id': 1 }, { unique: 1 } catch e then console.log e
try ChatSubscription._ensureIndex { 'u._id': 1, 'name': 1, 't': 1 }, { unique: 1 } catch e then console.log e
try ChatSubscription._ensureIndex { 'open': 1 } catch e then console.log e
try ChatSubscription._ensureIndex { 'alert': 1 } catch e then console.log e
try ChatSubscription._ensureIndex { 'unread': 1 } catch e then console.log e
try ChatSubscription._ensureIndex { 'ts': 1 } catch e then console.log e
try ChatMessage._ensureIndex { 'rid': 1, 'ts': 1 } catch e then console.log e
try ChatMessage._ensureIndex { 'ets': 1 }, { sparse: 1 } catch e then console.log e
try ChatMessage._ensureIndex { 'rid': 1, 't': 1, 'u._id': 1 } catch e then console.log e
......
......@@ -3,10 +3,9 @@ Meteor.startup ->
version: 3
up: ->
try
ChatSubscription._dropIndex 'uid_1'
try
ChatSubscription._dropIndex 'rid_1_uid_1'
RocketChat.models.Subscriptions.tryDropIndex 'uid_1'
RocketChat.models.Subscriptions.tryDropIndex 'rid_1_uid_1'
console.log 'Fixing ChatSubscription uid'
......
......@@ -4,7 +4,7 @@ Meteor.startup ->
up: ->
try ChatMessage._dropIndex 'rid_1'
try ChatSubscription._dropIndex 'u._id_1'
RocketChat.models.Subscriptions.tryDropIndex 'u._id_1'
console.log 'Rename rn to name'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment