firstly 0.9.1 → 0.9.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/CHANGELOG.md +6 -0
- package/esm/sqlAdmin/SqlAdminController.js +10 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# firstly
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#347](https://github.com/jycouet/firstly/pull/347) [`2a6576c`](https://github.com/jycouet/firstly/commit/2a6576ce7955ad73b38b3c07a3daf7c0fde78525) Thanks [@jycouet](https://github.com/jycouet)! - fix(sqlAdmin): read-only queries no longer fail with "nested transactions not allowed" on Postgres
|
|
8
|
+
|
|
3
9
|
## 0.9.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -21,17 +21,14 @@ export class SqlAdminController {
|
|
|
21
21
|
const db = SqlAdminController.dp ?? SqlDatabase.getDb();
|
|
22
22
|
const start = performance.now();
|
|
23
23
|
let rows = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const txDb = SqlDatabase.getDb(tx);
|
|
30
|
-
// Postgres: makes the whole transaction reject writes at the DB level.
|
|
24
|
+
// One transaction either way: a failing multi-statement script leaves nothing behind.
|
|
25
|
+
await db.transaction(async (tx) => {
|
|
26
|
+
const txDb = SqlDatabase.getDb(tx);
|
|
27
|
+
// Postgres: makes the whole transaction reject writes at the DB level.
|
|
28
|
+
if (!notReadOnly)
|
|
31
29
|
await txDb.execute('SET TRANSACTION READ ONLY');
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
30
|
+
rows = (await txDb.execute(cmd)).rows;
|
|
31
|
+
});
|
|
35
32
|
const took = performance.now() - start;
|
|
36
33
|
return { rows, rowCount: rows.length, took };
|
|
37
34
|
}
|
|
@@ -40,5 +37,8 @@ __decorate([
|
|
|
40
37
|
BackendMethod({
|
|
41
38
|
allowed: [Roles_SqlAdmin.SqlAdmin_Admin, FF_Role.FF_Role_Admin],
|
|
42
39
|
apiPrefix: 'ff/sqlAdmin',
|
|
40
|
+
// Remult wraps BackendMethods in a transaction by default; ours would then be
|
|
41
|
+
// nested, which Postgres rejects. We open our own below instead.
|
|
42
|
+
transactional: false,
|
|
43
43
|
})
|
|
44
44
|
], SqlAdminController, "exec", null);
|