improves test performance on mongodb (#4862)
* improves test performance on mongodb * Removes unused methdos
This commit is contained in:
@@ -313,11 +313,9 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
// Delete all data known to this adapter. Used for testing.
|
||||
deleteAllClasses() {
|
||||
return storageAdapterAllCollections(this)
|
||||
.then(collections => Promise.all(collections.map(collection => collection.drop())))
|
||||
.catch(err => this.handleError(err));
|
||||
dropDatabase() {
|
||||
if (!this.database) { return Promise.resolve(); }
|
||||
return this.database.dropDatabase();
|
||||
}
|
||||
|
||||
// Remove the column and all the data. For Relations, the _Join collection is handled
|
||||
|
||||
@@ -959,6 +959,10 @@ export class PostgresStorageAdapter implements StorageAdapter {
|
||||
});
|
||||
}
|
||||
|
||||
dropDatabase() {
|
||||
return this.deleteAllClasses();
|
||||
}
|
||||
|
||||
// Remove the column and all the data. For Relations, the _Join collection is handled
|
||||
// specially, this function does not delete _Join columns. It should, however, indicate
|
||||
// that the relation fields does not exist anymore. In mongo, this means removing it from
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface StorageAdapter {
|
||||
addFieldIfNotExists(className: string, fieldName: string, type: any): Promise<void>;
|
||||
deleteClass(className: string): Promise<void>;
|
||||
deleteAllClasses(): Promise<void>;
|
||||
dropDatabase(): Promise<void>;
|
||||
deleteFields(className: string, schema: SchemaType, fieldNames: Array<string>): Promise<void>;
|
||||
getAllClasses(): Promise<StorageClass[]>;
|
||||
getClass(className: string): Promise<StorageClass>;
|
||||
|
||||
@@ -658,7 +658,7 @@ class DatabaseController {
|
||||
deleteEverything() {
|
||||
this.schemaPromise = null;
|
||||
return Promise.all([
|
||||
this.adapter.deleteAllClasses(),
|
||||
this.adapter.dropDatabase(),
|
||||
this.schemaCache.clear()
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user