Replace index commands from ChatSubscription

pull/822/head
Rodrigo Nascimento 11 years ago
parent 231480825b
commit c8f6e154fb
  1. 7
      packages/rocketchat-lib/server/models/Subscriptions.coffee
  2. 7
      server/startup/indexes.coffee
  3. 7
      server/startup/migrations/v3.coffee
  4. 2
      server/startup/migrations/v4.coffee

@ -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'

Loading…
Cancel
Save