@@ -1556,4 +1556,21 @@ describe('schemas', () => {
|
|||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('gives correct response when deleting a schema with CLPs (regression test #1919)', done => {
|
||||||
|
new Parse.Object('MyClass').save({ data: 'foo'})
|
||||||
|
.then(obj => obj.destroy())
|
||||||
|
.then(() => setPermissionsOnClass('MyClass', { find: {}, get: {} }, true))
|
||||||
|
.then(() => {
|
||||||
|
request.del({
|
||||||
|
url: 'http://localhost:8378/1/schemas/MyClass',
|
||||||
|
headers: masterKeyHeaders,
|
||||||
|
json: true,
|
||||||
|
}, (error, response, body) => {
|
||||||
|
expect(response.statusCode).toEqual(200);
|
||||||
|
expect(response.body).toEqual({});
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ function modifySchema(req) {
|
|||||||
// A helper function that removes all join tables for a schema. Returns a promise.
|
// A helper function that removes all join tables for a schema. Returns a promise.
|
||||||
var removeJoinTables = (database, mongoSchema) => {
|
var removeJoinTables = (database, mongoSchema) => {
|
||||||
return Promise.all(Object.keys(mongoSchema)
|
return Promise.all(Object.keys(mongoSchema)
|
||||||
.filter(field => mongoSchema[field].startsWith('relation<'))
|
.filter(field => field !== '_metadata' && mongoSchema[field].startsWith('relation<'))
|
||||||
.map(field => {
|
.map(field => {
|
||||||
let collectionName = `_Join:${field}:${mongoSchema._id}`;
|
let collectionName = `_Join:${field}:${mongoSchema._id}`;
|
||||||
return database.adapter.deleteOneSchema(collectionName);
|
return database.adapter.deleteOneSchema(collectionName);
|
||||||
|
|||||||
Reference in New Issue
Block a user