src/CRUD.SqliteAdapter.js
function createIndexes() {
            // create listed indexes if they don't already exist.
            return Promise.all(Object.keys(CRUD.EntityManager.entities).map(function(entityName) {
                var entity = CRUD.EntityManager.entities[entityName];
                if (('indexes' in entity)) {
                    return Promise.all(entity.indexes.map(function(index) {
                        var indexName = index.replace(/\W/g, '') + '_idx';
                        if (!(entity.table in indexes) || indexes[entity.table].indexOf(indexName) == -1) {
                            return db.execute("create index if not exists " + indexName + " on " + entity.table + " (" + index + ")").then(function(result) {
                                CRUD.log("index created: ", entity.table, index, indexName);
                                if (!(entity.table in indexes)) {
                                    indexes[entity.table] = [];
                                }
                                indexes[entity.table].push(indexName);
                                return;
                            });
                        }
                        return;
                    }));
                }
            }));
        }
function createIndexes() {
            // create listed indexes if they don't already exist.
            return Promise.all(Object.keys(CRUD.EntityManager.entities).map(function(entityName) {
                var entity = CRUD.EntityManager.entities[entityName];
                if (('indexes' in entity)) {
                    return Promise.all(entity.indexes.map(function(index) {
                        var indexName = index.replace(/\W/g, '') + '_idx';
                        if (!(entity.table in indexes) || indexes[entity.table].indexOf(indexName) == -1) {
                            return db.execute("create index if not exists " + indexName + " on " + entity.table + " (" + index + ")").then(function(result) {
                                CRUD.log("index created: ", entity.table, index, indexName);
                                if (!(entity.table in indexes)) {
                                    indexes[entity.table] = [];
                                }
                                indexes[entity.table].push(indexName);
                                return;
                            });
                        }
                        return;
                    }));
                }
            }));
        }
function createIndexes ( ) { // create listed indexes if they don't already exist. return Promise . all ( Object . keys ( CRUD . EntityManager . entities ) . map ( function ( entityName ) { var entity = CRUD . EntityManager . entities [ entityName ] ; if ( ( 'indexes' in entity ) ) { return Promise . all ( entity . indexes . map ( function ( index ) { var indexName = index . replace ( / \W / g , '' ) + '_idx' ; if ( ! ( entity . table in indexes ) || indexes [ entity . table ] . indexOf ( indexName ) == - 1 ) { return db . execute ( "create index if not exists " + indexName + " on " + entity . table + " (" + index + ")" ) . then ( function ( result ) { CRUD . log ( "index created: " , entity . table , index , indexName ) ; if ( ! ( entity . table in indexes ) ) { indexes [ entity . table ] = [ ] ; } indexes [ entity . table ] . push ( indexName ) ; return ; } ) ; } return ; } ) ) ; } } ) ) ; }
Iterate the list of existing and non-existing indexes for each entity and create the ones that don't exist.
@return {void} void
Iterate the list of existing and non - existing indexes for each entity and create the ones that don t exist .