Adds index on _Role name property (#3586)

* Adds index on _Role name property

In order to avoid having different _Role objects with the same name, adding an index on the name property of _Role is necessary.

Fixes #3579

* Uses throw instead of Promise.reject when enforcing unique indexes

* Fixes wrong sorting of results in schemas tests
This commit is contained in:
Natan Rolnik
2017-03-04 22:42:19 +02:00
committed by Arthur Cinader
parent 0181fb51b3
commit 9bfa0c60c4
4 changed files with 53 additions and 7 deletions

View File

@@ -494,7 +494,8 @@ describe('SchemaController', () => {
it('creates non-custom classes which include relation field', done => {
config.database.loadSchema()
.then(schema => schema.addClassIfNotExists('_Role', {}))
//as `_Role` is always created by default, we only get it here
.then(schema => schema.getOneSchema('_Role'))
.then(actualSchema => {
const expectedSchema = {
className: '_Role',