@strapi/database 4.6.0 → 4.6.1

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.
@@ -25,6 +25,8 @@ const OPERATORS = [
25
25
  '$between',
26
26
  '$startsWith',
27
27
  '$endsWith',
28
+ '$startsWithi',
29
+ '$endsWithi',
28
30
  '$contains',
29
31
  '$notContains',
30
32
  '$containsi',
@@ -283,10 +285,18 @@ const applyOperator = (qb, column, operator, value) => {
283
285
  qb.where(column, 'like', `${value}%`);
284
286
  break;
285
287
  }
288
+ case '$startsWithi': {
289
+ qb.whereRaw(`${fieldLowerFn(qb)} LIKE LOWER(?)`, [column, `${value}%`]);
290
+ break;
291
+ }
286
292
  case '$endsWith': {
287
293
  qb.where(column, 'like', `%${value}`);
288
294
  break;
289
295
  }
296
+ case '$endsWithi': {
297
+ qb.whereRaw(`${fieldLowerFn(qb)} LIKE LOWER(?)`, [column, `%${value}`]);
298
+ break;
299
+ }
290
300
  case '$contains': {
291
301
  qb.where(column, 'like', `%${value}%`);
292
302
  break;
@@ -32,7 +32,7 @@ const getLinksWithoutMappedBy = (db) => {
32
32
 
33
33
  const isLinkTableEmpty = async (db, linkTableName) => {
34
34
  // If the table doesn't exist, it's empty
35
- const exists = await db.getConnection().schema.hasTable(linkTableName);
35
+ const exists = await db.getSchemaConnection().hasTable(linkTableName);
36
36
  if (!exists) return true;
37
37
 
38
38
  const result = await db.getConnection().count('* as count').from(linkTableName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "description": "Strapi's database layer",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -43,5 +43,5 @@
43
43
  "node": ">=14.19.1 <=18.x.x",
44
44
  "npm": ">=6.0.0"
45
45
  },
46
- "gitHead": "a9e55435c489f3379d88565bf3f729deb29bfb45"
46
+ "gitHead": "17a7845e3d453ea2e7911bda6ec25ed196dd5f16"
47
47
  }