@strapi/database 4.6.0 → 4.6.2

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.
@@ -16,11 +16,18 @@ class PostgresDialect extends Dialect {
16
16
  }
17
17
 
18
18
  async initialize() {
19
+ // Don't cast DATE string to Date()
19
20
  this.db.connection.client.driver.types.setTypeParser(
20
21
  this.db.connection.client.driver.types.builtins.DATE,
21
22
  'text',
22
23
  (v) => v
23
- ); // Don't cast DATE string to Date()
24
+ );
25
+ // Don't parse JSONB automatically
26
+ this.db.connection.client.driver.types.setTypeParser(
27
+ this.db.connection.client.driver.types.builtins.JSONB,
28
+ 'text',
29
+ (v) => v
30
+ );
24
31
  this.db.connection.client.driver.types.setTypeParser(
25
32
  this.db.connection.client.driver.types.builtins.NUMERIC,
26
33
  'text',
@@ -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;
@@ -1,6 +1,6 @@
1
- export function isScalar(type: string): boolean
2
- export function isNumber(type: string): boolean
3
- export function isString(type: string): boolean
4
- export function isComponent(type: string): boolean
5
- export function isDynamicZone(type: string): boolean
6
- export function isRelation(type: string): boolean
1
+ export function isScalar(type: string): boolean;
2
+ export function isNumber(type: string): boolean;
3
+ export function isString(type: string): boolean;
4
+ export function isComponent(type: string): boolean;
5
+ export function isDynamicZone(type: string): boolean;
6
+ export function isRelation(type: string): boolean;
@@ -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.2",
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": "bae505f44c3a779905f6b8dbc0c497e24d9eabfb"
47
47
  }