@strapi/database 5.4.0 → 5.4.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.
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path$1 from "node:path";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import fse from "fs-extra";
|
|
3
4
|
import createDebug from "debug";
|
|
@@ -6281,7 +6282,7 @@ const QUERIES = {
|
|
|
6281
6282
|
SELECT :tableName:.id as id, string_agg(DISTINCT :inverseJoinColumn:::character varying, ',') as other_ids
|
|
6282
6283
|
FROM :tableName:
|
|
6283
6284
|
LEFT JOIN :joinTableName: ON :tableName:.id = :joinTableName:.:joinColumn:
|
|
6284
|
-
WHERE document_id IS NULL
|
|
6285
|
+
WHERE :tableName:.document_id IS NULL
|
|
6285
6286
|
GROUP BY :tableName:.id, :joinTableName:.:joinColumn:
|
|
6286
6287
|
LIMIT 1;
|
|
6287
6288
|
`,
|
|
@@ -6295,7 +6296,7 @@ const QUERIES = {
|
|
|
6295
6296
|
SELECT :tableName:.id as id, group_concat(DISTINCT :inverseJoinColumn:) as other_ids
|
|
6296
6297
|
FROM :tableName:
|
|
6297
6298
|
LEFT JOIN :joinTableName: ON :tableName:.id = :joinTableName:.:joinColumn:
|
|
6298
|
-
WHERE document_id IS NULL
|
|
6299
|
+
WHERE :tableName:.document_id IS NULL
|
|
6299
6300
|
GROUP BY :tableName:.id, :joinTableName:.:joinColumn:
|
|
6300
6301
|
LIMIT 1;
|
|
6301
6302
|
`,
|
|
@@ -6309,7 +6310,7 @@ const QUERIES = {
|
|
|
6309
6310
|
SELECT :tableName:.id as id, group_concat(DISTINCT :inverseJoinColumn:) as other_ids
|
|
6310
6311
|
FROM :tableName:
|
|
6311
6312
|
LEFT JOIN :joinTableName: ON :tableName:.id = :joinTableName:.:joinColumn:
|
|
6312
|
-
WHERE document_id IS NULL
|
|
6313
|
+
WHERE :tableName:.document_id IS NULL
|
|
6313
6314
|
GROUP BY :joinTableName:.:joinColumn:
|
|
6314
6315
|
LIMIT 1;
|
|
6315
6316
|
`,
|
|
@@ -7026,6 +7027,27 @@ class Database {
|
|
|
7026
7027
|
const connection = tableName ? this.connection(tableName) : this.connection;
|
|
7027
7028
|
return schema ? connection.withSchema(schema) : connection;
|
|
7028
7029
|
}
|
|
7030
|
+
// Returns basic info about the database connection
|
|
7031
|
+
getInfo() {
|
|
7032
|
+
const connectionSettings = this.connection?.client?.connectionSettings || {};
|
|
7033
|
+
const client = this.dialect?.client || "";
|
|
7034
|
+
let displayName = "";
|
|
7035
|
+
let schema;
|
|
7036
|
+
if (client === "sqlite") {
|
|
7037
|
+
const absolutePath = connectionSettings?.filename;
|
|
7038
|
+
if (absolutePath) {
|
|
7039
|
+
displayName = path$1.relative(process.cwd(), absolutePath);
|
|
7040
|
+
}
|
|
7041
|
+
} else {
|
|
7042
|
+
displayName = connectionSettings?.database;
|
|
7043
|
+
schema = connectionSettings?.schema;
|
|
7044
|
+
}
|
|
7045
|
+
return {
|
|
7046
|
+
displayName,
|
|
7047
|
+
schema,
|
|
7048
|
+
client
|
|
7049
|
+
};
|
|
7050
|
+
}
|
|
7029
7051
|
getSchemaConnection(trx = this.connection) {
|
|
7030
7052
|
const schema = this.getSchemaName();
|
|
7031
7053
|
return schema ? trx.schema.withSchema(schema) : trx.schema;
|