message: SAVEPOINT only works when there is an existing wrapper transaction
diff: import config from 'config';
  import { Client, Pool, PoolClient } from 'pg';
  import { URL } from 'url';
  -import crypto from 'crypto';
  export default class DatabaseManager {
  private client: Client | undefined;
  @@ -36,17 +35,21 @@ export default class DatabaseManager {
  }
  async performTransaction(db: Client, cb: any) {
  - let transactionId = `tx_${crypto.randomBytes(20).toString('hex')}`;
  + let isTestEnv = process.env.NODE_ENV === 'test';
  + if (isTestEnv) {
  + await cb(); // Don't commit any data to the test db
  + } else {
  try {
  - await db.query(`SAVEPOINT ${transactionId}`);
  + await db.query('BEGIN');
  await cb();
  - await db.query(`RELEASE SAVEPOINT ${transactionId}`);
  + await db.query('COMMIT');
  } catch (e) {
  - await db.query(`ROLLBACK TO SAVEPOINT ${transactionId}`);
  + await db.query('ROLLBACK');
  throw e;
  }
  }
  + }
  async teardown() {
  if (this.dbConfig.useTransactionalRollbacks) {
  