async doSyncAction(syncActions) {
        try {
            await this.sequelize.sync({alter: !syncActions.drop && syncActions.alter});
            if(syncActions.drop || !syncActions.alter) {
                await Promise.all(Object.keys(this.sequelize.models)
                    .map(key => this.sequelize.models[key])
                    .sort((a, b) => {
                        // @ts-ignore
                        if((a.priority || 999) > (b.priority  || 999)) return -1;
                        // @ts-ignore
                        if((a.priority || 999) < (b.priority  || 999)) return 1;
                        return 0;
                    })
                    .map(async Model => {
                        // @ts-ignore
                        if(Model.onFirstInstall) {
                            // @ts-ignore
                            await Model.onFirstInstall();
                            console.log("INFO", `Running first install initialization for model [${Model.name}]`);
                        }
                    }));

                await CustomerLogicHandler.instance.runAllCustomerLogicFunction("sequelizeOnFirstInstall", {sequelize: this.sequelize, sequelizeLoader: this});
            }
        }
        catch(err) {
            console.log("CRITICAL", `Failed to sync database properly: ${JSON.stringify(err, null, 2)}; ${err}`);
            process.exit(1);
        }
    }
/**
     * Syncs models with the database
     * @param {Object} syncActions
     */
Syncs models with the database
@param {Object} syncActions
Syncs models with the database @param { Object } syncActions
async doSyncAction(syncActions) {
        try {
            await this.sequelize.sync({alter: !syncActions.drop && syncActions.alter});
            if(syncActions.drop || !syncActions.alter) {
                await Promise.all(Object.keys(this.sequelize.models)
                    .map(key => this.sequelize.models[key])
                    .sort((a, b) => {
                        if((a.priority || 999) > (b.priority  || 999)) return -1;
                        if((a.priority || 999) < (b.priority  || 999)) return 1;
                        return 0;
                    })
                    .map(async Model => {
                        if(Model.onFirstInstall) {
                            await Model.onFirstInstall();
                            console.log("INFO", `Running first install initialization for model [${Model.name}]`);
                        }
                    }));
                await CustomerLogicHandler.instance.runAllCustomerLogicFunction("sequelizeOnFirstInstall", {sequelize: this.sequelize, sequelizeLoader: this});
            }
        }
        catch(err) {
            console.log("CRITICAL", `Failed to sync database properly: ${JSON.stringify(err, null, 2)}; ${err}`);
            process.exit(1);
        }
    }
async doSyncAction ( syncActions ) { try { await this . sequelize . sync ( { alter : ! syncActions . drop && syncActions . alter } ) ; if ( syncActions . drop || ! syncActions . alter ) { await Promise . all ( Object . keys ( this . sequelize . models ) . map ( key => this . sequelize . models [ key ] ) . sort ( ( a , b ) => { if ( ( a . priority || 999 ) > ( b . priority || 999 ) ) return - 1 ; if ( ( a . priority || 999 ) < ( b . priority || 999 ) ) return 1 ; return 0 ; } ) . map ( async Model => { if ( Model . onFirstInstall ) { await Model . onFirstInstall ( ) ; console . log ( "INFO" , ` ${ Model . name } ` ) ; } } ) ) ; await CustomerLogicHandler . instance . runAllCustomerLogicFunction ( "sequelizeOnFirstInstall" , { sequelize : this . sequelize , sequelizeLoader : this } ) ; } } catch ( err ) { console . log ( "CRITICAL" , ` ${ JSON . stringify ( err , null , 2 ) } ${ err } ` ) ; process . exit ( 1 ) ; } }
Syncs models with the database
 @param {Object} syncActions
Syncs models with the database @param { Object } syncActions
// @ts-ignore // @ts-ignore // @ts-ignore // @ts-ignore