lib/index.js
function getBelongsToManyDetails(hasManyThrough) {
    logger.debug('belongsToMany details are calculated for: %s', hasManyThrough.name());
    var model   = getModelNameFor(hasManyThrough.referencesTable()),
        as      = getBelongsToManyName(hasManyThrough);

    return filterAttributes({
        type                : 'belongsToMany',
        source              : 'generator',
        name                : hasManyThrough.name(),
        model               : model,
        as                  : getAlias(hasManyThrough.table(), as, 'belongsToMany'),
        targetSchema        : hasManyThrough.referencesTable().schema().name(),
        targetTable         : hasManyThrough.referencesTable().name(),
        foreignKey          : hasManyThrough.foreignKey(0).name(),      // Sequelize support single key only
        otherKey            : hasManyThrough.throughForeignKeyConstraint().foreignKey(0).name(),        // Sequelize support single key only
        onDelete            : hasManyThrough.onDelete(),
        onUpdate            : hasManyThrough.onUpdate(),
        through             : hasManyThrough.through().name()
    });
}
function getBelongsToManyDetails(hasManyThrough) {
    logger.debug('belongsToMany details are calculated for: %s', hasManyThrough.name());
    var model   = getModelNameFor(hasManyThrough.referencesTable()),
        as      = getBelongsToManyName(hasManyThrough);

    return filterAttributes({
        type                : 'belongsToMany',
        source              : 'generator',
        name                : hasManyThrough.name(),
        model               : model,
        as                  : getAlias(hasManyThrough.table(), as, 'belongsToMany'),
        targetSchema        : hasManyThrough.referencesTable().schema().name(),
        targetTable         : hasManyThrough.referencesTable().name(),
        foreignKey          : hasManyThrough.foreignKey(0).name(),      // Sequelize support single key only
        otherKey            : hasManyThrough.throughForeignKeyConstraint().foreignKey(0).name(),        // Sequelize support single key only
        onDelete            : hasManyThrough.onDelete(),
        onUpdate            : hasManyThrough.onUpdate(),
        through             : hasManyThrough.through().name()
    });
}
function getBelongsToManyDetails ( hasManyThrough ) { logger . debug ( 'belongsToMany details are calculated for: %s' , hasManyThrough . name ( ) ) ; var model = getModelNameFor ( hasManyThrough . referencesTable ( ) ) , as = getBelongsToManyName ( hasManyThrough ) ; return filterAttributes ( { type : 'belongsToMany' , source : 'generator' , name : hasManyThrough . name ( ) , model : model , as : getAlias ( hasManyThrough . table ( ) , as , 'belongsToMany' ) , targetSchema : hasManyThrough . referencesTable ( ) . schema ( ) . name ( ) , targetTable : hasManyThrough . referencesTable ( ) . name ( ) , foreignKey : hasManyThrough . foreignKey ( 0 ) . name ( ) , // Sequelize support single key only otherKey : hasManyThrough . throughForeignKeyConstraint ( ) . foreignKey ( 0 ) . name ( ) , // Sequelize support single key only onDelete : hasManyThrough . onDelete ( ) , onUpdate : hasManyThrough . onUpdate ( ) , through : hasManyThrough . through ( ) . name ( ) } ) ; }
Returns belongsToMany details as plain object to use in templates.
@private
@param {object} hasManyThrough - pg-structure hasManyThrough object
@returns {Object} - Simple object to use in template
Returns belongsToMany details as plain object to use in templates .