Skip to content

Commit

Permalink
Merge pull request parse-community#881 from Marco129/fix-delete-field
Browse files Browse the repository at this point in the history
Improve delete flow for non-existence _Join collection
  • Loading branch information
drew-gross committed Mar 7, 2016
2 parents b36fd6f + 91ff816 commit 53e7337
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,14 @@ class Schema {

if (this.data[className][fieldName].startsWith('relation<')) {
//For relations, drop the _Join table
return database.collectionExists(`_Join:${fieldName}:${className}`).then(exist => {
if (exist) {
return database.dropCollection(`_Join:${fieldName}:${className}`);
return database.dropCollection(`_Join:${fieldName}:${className}`)
.then(() => {
return Promise.resolve();
}, error => {
if (error.message == 'ns not found') {
return Promise.resolve();
}
return Promise.reject(error);
});
}

Expand Down

0 comments on commit 53e7337

Please sign in to comment.