@strapi/database 4.5.0 → 4.5.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.
|
@@ -226,8 +226,7 @@ const cleanOrderColumns = async ({ id, attribute, db, inverseRelIds, transaction
|
|
|
226
226
|
// https://github.com/knex/knex/issues/2504
|
|
227
227
|
switch (strapi.db.dialect.client) {
|
|
228
228
|
case 'mysql':
|
|
229
|
-
await db
|
|
230
|
-
.getConnection()
|
|
229
|
+
await db.connection
|
|
231
230
|
.raw(
|
|
232
231
|
`UPDATE
|
|
233
232
|
?? as a,
|
|
@@ -243,17 +242,16 @@ const cleanOrderColumns = async ({ id, attribute, db, inverseRelIds, transaction
|
|
|
243
242
|
.transacting(trx);
|
|
244
243
|
break;
|
|
245
244
|
default:
|
|
246
|
-
await db
|
|
247
|
-
.getConnection()
|
|
245
|
+
await db.connection
|
|
248
246
|
.raw(
|
|
249
247
|
`UPDATE ?? as a
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
248
|
+
SET ${update.join(', ')}
|
|
249
|
+
FROM (
|
|
250
|
+
SELECT ${select.join(', ')}
|
|
251
|
+
FROM ??
|
|
252
|
+
WHERE ${where.join(' OR ')}
|
|
253
|
+
) AS b
|
|
254
|
+
WHERE b.id = a.id`,
|
|
257
255
|
[joinTable.name, ...updateBinding, ...selectBinding, joinTable.name, ...whereBinding]
|
|
258
256
|
)
|
|
259
257
|
.transacting(trx);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LifecycleProvider } from './lifecycles';
|
|
2
2
|
import { MigrationProvider } from './migrations';
|
|
3
|
-
import {
|
|
3
|
+
import { SchemaProvider } from './schema';
|
|
4
4
|
|
|
5
5
|
type LogicalOperators<T> = {
|
|
6
6
|
$and?: WhereParams<T>[];
|
|
@@ -154,7 +154,7 @@ interface DatabaseConfig {
|
|
|
154
154
|
models: ModelConfig[];
|
|
155
155
|
}
|
|
156
156
|
export interface Database {
|
|
157
|
-
schema:
|
|
157
|
+
schema: SchemaProvider;
|
|
158
158
|
lifecycles: LifecycleProvider;
|
|
159
159
|
migrations: MigrationProvider;
|
|
160
160
|
entityManager: EntityManager;
|
package/lib/schema/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface Model {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export interface
|
|
41
|
+
export interface SchemaProvider {
|
|
42
42
|
sync(): Promise<void>;
|
|
43
43
|
syncSchema(): Promise<void>;
|
|
44
44
|
reset(): Promise<void>;
|
|
@@ -46,4 +46,4 @@ export interface SchemaProvideer {
|
|
|
46
46
|
drop(): Promise<void>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export default function(db: Database):
|
|
49
|
+
export default function(db: Database): SchemaProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/database",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "Strapi's database layer",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"node": ">=14.19.1 <=18.x.x",
|
|
43
43
|
"npm": ">=6.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "8c20ea2b5c5a115b78454086ea270dcd59b06004"
|
|
46
46
|
}
|