code: function createAssociations(models, done) {
      Object.keys(models).forEach((key) => {
        let modelObj = models[key],
          instanceObj = modelObj.getInstance();
        modelObj.relations.forEach((relation) => {
          let targetModel = models[relation.name];
          if (!targetModel) {
            throw thorin.error('SQL.INVALID_ASSOCIATION', 'Target association: ' + relation.type + " " + relation.name + ' does not exist for ' + modelObj.code);
          }
          let targetInstanceObj = targetModel.getInstance();
          let opt = thorin.util.extend(getAssociationOptions(targetModel.tableName, relation.options, modelObj), {
            as: targetModel.code
          }, relation.options);
          relation.options = opt;
          if (opt.private) {
            modelObj.privateAttributes.push(opt.foreignKey.name);
          }
          try {
            instanceObj[relation.type](targetInstanceObj, opt);
          } catch (e) {
            console.error('Thorin.sql: could not create sequelize association: %s %s %s', modelObj.code, relation.type, targetModel.code, e.stack);
          }
        });
      });
      done();
    }
docs: /*
  Creates the associations between models.