src/CRUD.SqliteAdapter.js
/**
         * 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.
@return {void} void
Iterate the list of existing and non - existing indexes for each entity and create the ones that don ' t exist . @return { void } void
function createIndexes() {
            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 ( ) { 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.
Iterate the list of existing and non - existing indexes for each entity and create the ones that don ' t exist .
// create listed indexes if they don't already exist.