@strapi/database 4.3.2 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,7 +71,7 @@ const createQueryBuilder = (uid, db) => {
71
71
  return this;
72
72
  },
73
73
 
74
- count(count = '*') {
74
+ count(count = 'id') {
75
75
  state.type = 'count';
76
76
  state.count = count;
77
77
 
@@ -301,10 +301,13 @@ const createQueryBuilder = (uid, db) => {
301
301
  break;
302
302
  }
303
303
  case 'count': {
304
- const dbColumnName =
305
- state.count === '*' ? '*' : this.aliasColumn(helpers.toColumnName(meta, state.count));
304
+ const dbColumnName = this.aliasColumn(helpers.toColumnName(meta, state.count));
306
305
 
307
- qb.count({ count: dbColumnName });
306
+ if (this.shouldUseDistinct()) {
307
+ qb.countDistinct({ count: dbColumnName });
308
+ } else {
309
+ qb.count({ count: dbColumnName });
310
+ }
308
311
  break;
309
312
  }
310
313
  case 'max': {
@@ -53,7 +53,7 @@ module.exports = db => {
53
53
  const diffIndexes = (oldIndex, index) => {
54
54
  const changes = [];
55
55
 
56
- if (_.difference(oldIndex.columns, index.columns).length > 0) {
56
+ if (!_.isEqual(oldIndex.columns, index.columns)) {
57
57
  changes.push('columns');
58
58
  }
59
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "description": "Strapi's database layer",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -42,5 +42,5 @@
42
42
  "node": ">=14.19.1 <=16.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "7039c0d22836c94457130515b3a55eb93d2411f8"
45
+ "gitHead": "4d60bfdeee6eb5e9b42b5a614690d7bb86c5f84a"
46
46
  }