File size: 685 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
exports.up = function(r, conn) {
  const createCustomersTable = () =>
    r.tableCreate('stripeCustomers', { primaryKey: 'customerId' }).run(conn);
  const createInvoicesTable = () =>
    r.tableCreate('stripeInvoices', { primaryKey: 'invoiceId' }).run(conn);

  return Promise.all([createCustomersTable(), createInvoicesTable()])
    .then(() =>
      Promise.all([
        r
          .table('stripeInvoices')
          .indexCreate('customerId')
          .run(conn),
      ])
    )
    .catch(err => console.log(err));
};

exports.down = function(r, conn) {
  return Promise.all([
    r.tableDrop('stripeCustomers').run(conn),
    r.tableDrop('stripeInvoices').run(conn),
  ]);
};