@strapi/database 4.11.3 → 4.12.0-beta.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.
package/lib/dialects/dialect.js
CHANGED
|
@@ -7,6 +7,8 @@ const errors = require('../../errors');
|
|
|
7
7
|
const { Dialect } = require('../dialect');
|
|
8
8
|
const SqliteSchemaInspector = require('./schema-inspector');
|
|
9
9
|
|
|
10
|
+
const UNSUPPORTED_OPERATORS = ['$jsonSupersetOf'];
|
|
11
|
+
|
|
10
12
|
class SqliteDialect extends Dialect {
|
|
11
13
|
constructor(db) {
|
|
12
14
|
super(db);
|
|
@@ -54,6 +56,10 @@ class SqliteDialect extends Dialect {
|
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
supportsOperator(operator) {
|
|
60
|
+
return !UNSUPPORTED_OPERATORS.includes(operator);
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
async startSchemaUpdate() {
|
|
58
64
|
await this.db.connection.raw(`pragma foreign_keys = off`);
|
|
59
65
|
}
|
|
@@ -25,6 +25,8 @@ const parseDateTimeOrTimestamp = (value) => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const parseDate = (value) => {
|
|
28
|
+
if (dateFns.isDate(value)) return dateFns.format(value, 'yyyy-MM-dd');
|
|
29
|
+
|
|
28
30
|
const found = isString(value) ? value.match(PARTIAL_DATE_REGEX) || [] : [];
|
|
29
31
|
const extractedValue = found[0];
|
|
30
32
|
|
|
@@ -276,7 +276,14 @@ const applyOperator = (qb, column, operator, value) => {
|
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
//
|
|
279
|
+
// Only on MySQL, PostgreSQL and CockroachDB.
|
|
280
|
+
// https://knexjs.org/guide/query-builder.html#wherejsonsupersetof
|
|
281
|
+
case '$jsonSupersetOf': {
|
|
282
|
+
qb.whereJsonSupersetOf(column, value);
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// TODO: Add more JSON operators: whereJsonObject, whereJsonPath, whereJsonSubsetOf
|
|
280
287
|
|
|
281
288
|
// TODO: relational operators every/some/exists/size ...
|
|
282
289
|
|
package/lib/schema/diff.js
CHANGED
|
@@ -370,7 +370,9 @@ module.exports = (db) => {
|
|
|
370
370
|
})
|
|
371
371
|
.map((dependsOnTable) => {
|
|
372
372
|
return srcSchema.tables.find((srcTable) => srcTable.name === dependsOnTable.name);
|
|
373
|
-
})
|
|
373
|
+
})
|
|
374
|
+
// In case the table is not found, filter undefined values
|
|
375
|
+
.filter((table) => !_.isNil(table));
|
|
374
376
|
|
|
375
377
|
removedTables.push(srcTable, ...dependencies);
|
|
376
378
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/database",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0-beta.0",
|
|
4
4
|
"description": "Strapi's database layer",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"lint": "run -T eslint ."
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@strapi/utils": "4.
|
|
36
|
+
"@strapi/utils": "4.12.0-beta.0",
|
|
37
37
|
"date-fns": "2.30.0",
|
|
38
38
|
"debug": "4.3.4",
|
|
39
39
|
"fs-extra": "10.0.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"node": ">=14.19.1 <=18.x.x",
|
|
47
47
|
"npm": ">=6.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "b965b428a445bdbc81fb4b70120237f2d48e7647"
|
|
50
50
|
}
|