Merge pull request #881 from Marco129/fix-delete-field
Improve delete flow for non-existence _Join collection
This commit is contained in:
@@ -409,10 +409,14 @@ class Schema {
|
|||||||
|
|
||||||
if (this.data[className][fieldName].startsWith('relation<')) {
|
if (this.data[className][fieldName].startsWith('relation<')) {
|
||||||
//For relations, drop the _Join table
|
//For relations, drop the _Join table
|
||||||
return database.collectionExists(`_Join:${fieldName}:${className}`).then(exist => {
|
return database.dropCollection(`_Join:${fieldName}:${className}`)
|
||||||
if (exist) {
|
.then(() => {
|
||||||
return database.dropCollection(`_Join:${fieldName}:${className}`);
|
return Promise.resolve();
|
||||||
|
}, error => {
|
||||||
|
if (error.message == 'ns not found') {
|
||||||
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user