File size: 899 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
exports.up = function(r, conn) {
  return Promise.all([
    // messages#threadIdAndTimestamp
    r
      .table('messages')
      .indexCreate('threadIdAndTimestamp', [
        r.row('threadId'),
        r.row('timestamp'),
      ])
      .run(conn),
    // threads#channelIdAndLastActive
    r
      .table('threads')
      .indexCreate('channelIdAndLastActive', [
        r.row('channelId'),
        r.row('lastActive'),
      ])
      .run(conn),
    // threads#communityIdAndLastActive
    r
      .table('threads')
      .indexCreate('communityIdAndLastActive', [
        r.row('communityId'),
        r.row('lastActive'),
      ])
      .run(conn),
    // community#createdAt
    r
      .table('communities')
      .indexCreate('createdAt')
      .run(conn),
  ]).catch(err => {
    console.log(err);
    throw err;
  });
};

exports.down = function(r, conn) {
  return Promise.resolve();
};