From d3f895cce28f0a525e292d98dc591d6a2efdcad3 Mon Sep 17 00:00:00 2001 From: Denis Ferrero Date: Tue, 11 Jan 2022 15:06:10 +0100 Subject: [PATCH] use "as" value rather than the real name --- packages/moleculer-db-adapter-sequelize/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/moleculer-db-adapter-sequelize/src/index.js b/packages/moleculer-db-adapter-sequelize/src/index.js index fad7c1b2..049541a8 100644 --- a/packages/moleculer-db-adapter-sequelize/src/index.js +++ b/packages/moleculer-db-adapter-sequelize/src/index.js @@ -302,7 +302,7 @@ class SequelizeDbAdapter { * @returns {Promise} */ createCursor(params, isCounting) { - const strictCountRule = { distinct: true, col: `${this.model.tableName}.${this.model.primaryKeyAttribute}` }; + const strictCountRule = { distinct: true, col: `${this.model.name ||this.model.tableName}.${this.model.primaryKeyAttribute}` }; if (!params) { if (isCounting) return this.model.count(strictCountRule);