@strapi/database 4.3.0-beta.2 → 4.3.2-alpha.0

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.
@@ -7,7 +7,7 @@ const { Umzug } = require('umzug');
7
7
  const createStorage = require('./storage');
8
8
 
9
9
  const wrapTransaction = db => fn => () =>
10
- db.getConnection().transaction(trx => Promise.resolve(fn(trx)));
10
+ db.connection.transaction(trx => Promise.resolve(fn(trx)));
11
11
 
12
12
  // TODO: check multiple commands in one sql statement
13
13
  const migrationResolver = ({ name, path, context }) => {
@@ -13,6 +13,7 @@ const OPERATORS = [
13
13
  '$in',
14
14
  '$notIn',
15
15
  '$eq',
16
+ '$eqi',
16
17
  '$ne',
17
18
  '$gt',
18
19
  '$gte',
@@ -133,7 +134,9 @@ const processWhere = (where, ctx) => {
133
134
  }
134
135
 
135
136
  if (isOperator(key)) {
136
- throw new Error(`Only $and, $or and $not can by used as root level operators. Found ${key}.`);
137
+ throw new Error(
138
+ `Only $and, $or and $not can only be used as root level operators. Found ${key}.`
139
+ );
137
140
  }
138
141
 
139
142
  const attribute = meta.attributes[key];
@@ -221,6 +224,15 @@ const applyOperator = (qb, column, operator, value) => {
221
224
  qb.where(column, value);
222
225
  break;
223
226
  }
227
+
228
+ case '$eqi': {
229
+ if (value === null) {
230
+ qb.whereNull(column);
231
+ break;
232
+ }
233
+ qb.whereRaw(`${fieldLowerFn(qb)} LIKE LOWER(?)`, [column, `${value}`]);
234
+ break;
235
+ }
224
236
  case '$ne': {
225
237
  if (value === null) {
226
238
  qb.whereNotNull(column);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "4.3.0-beta.2",
3
+ "version": "4.3.2-alpha.0",
4
4
  "description": "Strapi's database layer",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -34,7 +34,7 @@
34
34
  "date-fns": "2.28.0",
35
35
  "debug": "4.3.1",
36
36
  "fs-extra": "10.0.0",
37
- "knex": "1.0.4",
37
+ "knex": "1.0.7",
38
38
  "lodash": "4.17.21",
39
39
  "umzug": "3.1.1"
40
40
  },
@@ -42,5 +42,5 @@
42
42
  "node": ">=14.19.1 <=16.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "42aba356ad1b0751584d3b375e83baa4a2c18f65"
45
+ "gitHead": "8ab2db1497c3a5a805173b2d92248648b40a6f65"
46
46
  }