identifyModelTable() {
        if (this.type === CONF.TABLE_TYPE.unknown) {

            let tblParts = this.name.split(CONF.SPACE_REPLACE);
            if (tblParts.length > 1) {
                let tblPlural = this.name,
                    tblSingular = pluralize.singular(this.name);
                var _tables = this.database._tables;
                // Model: Search if it's singular is the beginning or plural end of any other table name
                if (_tables.find( tbl => new RegExp('(^'+tblSingular+CONF.SPACE_REPLACE+CONF.VALID_TABLENAME_REGEX+'$)|(^'+CONF.VALID_TABLENAME_REGEX+CONF.SPACE_REPLACE+tblPlural+'$)').test(tbl))) {
                    this.type = CONF.TABLE_TYPE.model
                } else {
                    this.type = CONF.TABLE_TYPE.unknown
                } 
            } else if (pluralize.isPlural(this.name)) {
                this.type = CONF.TABLE_TYPE.model;
            } else {
                this.type = CONF.TABLE_TYPE.unknown;
            }
            // group table by type
            if (this.type === CONF.TABLE_TYPE.model) {
                this.database.addTableTyped(this);
            }
        }
    }
/**
     * Identify if current Table type is model
     */
Identify if current Table type is model
Identify if current Table type is model
identifyModelTable() {
        if (this.type === CONF.TABLE_TYPE.unknown) {
            let tblParts = this.name.split(CONF.SPACE_REPLACE);
            if (tblParts.length > 1) {
                let tblPlural = this.name,
                    tblSingular = pluralize.singular(this.name);
                var _tables = this.database._tables;
                if (_tables.find( tbl => new RegExp('(^'+tblSingular+CONF.SPACE_REPLACE+CONF.VALID_TABLENAME_REGEX+'$)|(^'+CONF.VALID_TABLENAME_REGEX+CONF.SPACE_REPLACE+tblPlural+'$)').test(tbl))) {
                    this.type = CONF.TABLE_TYPE.model
                } else {
                    this.type = CONF.TABLE_TYPE.unknown
                } 
            } else if (pluralize.isPlural(this.name)) {
                this.type = CONF.TABLE_TYPE.model;
            } else {
                this.type = CONF.TABLE_TYPE.unknown;
            }
            if (this.type === CONF.TABLE_TYPE.model) {
                this.database.addTableTyped(this);
            }
        }
    }
identifyModelTable ( ) { if ( this . type === CONF . TABLE_TYPE . unknown ) { let tblParts = this . name . split ( CONF . SPACE_REPLACE ) ; if ( tblParts . length > 1 ) { let tblPlural = this . name , tblSingular = pluralize . singular ( this . name ) ; var _tables = this . database . _tables ; if ( _tables . find ( tbl => new RegExp ( '(^' + tblSingular + CONF . SPACE_REPLACE + CONF . VALID_TABLENAME_REGEX + '$)|(^' + CONF . VALID_TABLENAME_REGEX + CONF . SPACE_REPLACE + tblPlural + '$)' ) . test ( tbl ) ) ) { this . type = CONF . TABLE_TYPE . model } else { this . type = CONF . TABLE_TYPE . unknown } } else if ( pluralize . isPlural ( this . name ) ) { this . type = CONF . TABLE_TYPE . model ; } else { this . type = CONF . TABLE_TYPE . unknown ; } if ( this . type === CONF . TABLE_TYPE . model ) { this . database . addTableTyped ( this ) ; } } }
Identify if current Table type is model
Identify if current Table type is model
// Model: Search if it's singular is the beginning or plural end of any other table name // group table by type