@strapi/database 0.0.0-e6cac9fe30 → 0.0.0-fd8e4c6bfa

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.
@@ -80,7 +80,7 @@ const processPopulate = (populate, ctx) => {
80
80
  }
81
81
 
82
82
  if (!types.isRelation(attribute.type)) {
83
- throw new Error(`Invalid populate field. Expected a relation, got ${attribute.type}`);
83
+ continue;
84
84
  }
85
85
 
86
86
  // make sure id is present for future populate queries
@@ -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
 
@@ -295,10 +295,13 @@ const createQueryBuilder = (uid, db) => {
295
295
  break;
296
296
  }
297
297
  case 'count': {
298
- const dbColumnName =
299
- state.count === '*' ? '*' : this.aliasColumn(helpers.toColumnName(meta, state.count));
298
+ const dbColumnName = this.aliasColumn(helpers.toColumnName(meta, state.count));
300
299
 
301
- qb.count({ count: dbColumnName });
300
+ if (this.shouldUseDistinct()) {
301
+ qb.countDistinct({ count: dbColumnName });
302
+ } else {
303
+ qb.count({ count: dbColumnName });
304
+ }
302
305
  break;
303
306
  }
304
307
  case 'max': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "0.0.0-e6cac9fe30",
3
+ "version": "0.0.0-fd8e4c6bfa",
4
4
  "description": "Strapi's database layer",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -31,7 +31,7 @@
31
31
  "test:unit": "jest --verbose"
32
32
  },
33
33
  "dependencies": {
34
- "date-fns": "2.28.0",
34
+ "date-fns": "2.29.2",
35
35
  "debug": "4.3.1",
36
36
  "fs-extra": "10.0.0",
37
37
  "knex": "1.0.7",
@@ -42,5 +42,5 @@
42
42
  "node": ">=14.19.1 <=16.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "e6cac9fe309b80c9c59cde56d6b25fc6cd40bc8d"
45
+ "gitHead": "fd8e4c6bfa2fd687a3c62f8428e00f3b320c32c2"
46
46
  }