src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
// Delete all data known to this adapter. Used for testing.
Delete all data known to this adapter. Used for testing.
Delete all data known to this adapter . Used for testing .
deleteAllClasses() {
    let now = new Date().getTime();
    debug('deleteAllClasses');
    return this._client.any('SELECT * FROM "_SCHEMA"')
    .then(results => {
      let joins = results.reduce((list, schema) => {
        return list.concat(joinTablesForSchema(schema.schema));
      }, []);
      const classes = ['_SCHEMA','_PushStatus','_JobStatus','_Hooks','_GlobalConfig', ...results.map(result => result.className), ...joins];
      return this._client.tx(t=>t.batch(classes.map(className=>t.none('DROP TABLE IF EXISTS $<className:name>', { className }))));
    }, error => {
      if (error.code === PostgresRelationDoesNotExistError) {
        return;
      } else {
        throw error;
      }
    }).then(() => {
      debug(`deleteAllClasses done in ${new Date().getTime() - now}`);
    });
  }
deleteAllClasses ( ) { let now = new Date ( ) . getTime ( ) ; debug ( 'deleteAllClasses' ) ; return this . _client . any ( 'SELECT * FROM "_SCHEMA"' ) . then ( results => { let joins = results . reduce ( ( list , schema ) => return list . concat ( joinTablesForSchema ( schema . schema ) ) ; } , [ ] ) ; const classes = [ '_SCHEMA' , '_PushStatus' , '_JobStatus' , '_Hooks' , '_GlobalConfig' , ... results . map ( result => result . className ) , ... joins ] ; return this . _client . tx ( t => t . batch ( classes . map ( className => t . none ( 'DROP TABLE IF EXISTS $<className:name>' , { className } ) ) ) ) ; } , error => { if ( error . code === PostgresRelationDoesNotExistError ) { return ; } else { throw error ; } } ) . then ( ( ) => debug ( ` ${ new Date ( ) . getTime ( ) - now } ` ) ; } ) ; }
Delete all data known to this adapter.
Delete all data known to this adapter .
// No _SCHEMA collection. Don't delete anything.