graphile-schema 1.7.0 → 1.7.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.
- package/build-schema.js +6 -2
- package/esm/build-schema.js +7 -3
- package/package.json +2 -2
package/build-schema.js
CHANGED
|
@@ -14,12 +14,16 @@ async function buildSchemaSDL(opts) {
|
|
|
14
14
|
const database = opts.database ?? 'constructive';
|
|
15
15
|
const schemas = Array.isArray(opts.schemas) ? opts.schemas : [];
|
|
16
16
|
const config = (0, pg_env_1.getPgEnvOptions)({ database });
|
|
17
|
-
|
|
17
|
+
// Create the pool through pg-cache so it is tracked and can be cleaned up
|
|
18
|
+
// by callers via pgCache.delete(database) before dropping ephemeral databases.
|
|
19
|
+
// Without this, makePgService creates its own internal pool that isn't released,
|
|
20
|
+
// causing "database has active sessions" errors during ephemeral DB teardown.
|
|
21
|
+
const pool = (0, pg_cache_1.getPgPool)(config);
|
|
18
22
|
const basePreset = {
|
|
19
23
|
extends: [graphile_settings_1.ConstructivePreset],
|
|
20
24
|
pgServices: [
|
|
21
25
|
(0, graphile_settings_1.makePgService)({
|
|
22
|
-
|
|
26
|
+
pool,
|
|
23
27
|
schemas,
|
|
24
28
|
}),
|
|
25
29
|
],
|
package/esm/build-schema.js
CHANGED
|
@@ -2,18 +2,22 @@ import deepmerge from 'deepmerge';
|
|
|
2
2
|
import { printSchema } from 'graphql';
|
|
3
3
|
import { ConstructivePreset, makePgService } from 'graphile-settings';
|
|
4
4
|
import { makeSchema } from 'graphile-build';
|
|
5
|
-
import {
|
|
5
|
+
import { getPgPool } from 'pg-cache';
|
|
6
6
|
import { getPgEnvOptions } from 'pg-env';
|
|
7
7
|
export async function buildSchemaSDL(opts) {
|
|
8
8
|
const database = opts.database ?? 'constructive';
|
|
9
9
|
const schemas = Array.isArray(opts.schemas) ? opts.schemas : [];
|
|
10
10
|
const config = getPgEnvOptions({ database });
|
|
11
|
-
|
|
11
|
+
// Create the pool through pg-cache so it is tracked and can be cleaned up
|
|
12
|
+
// by callers via pgCache.delete(database) before dropping ephemeral databases.
|
|
13
|
+
// Without this, makePgService creates its own internal pool that isn't released,
|
|
14
|
+
// causing "database has active sessions" errors during ephemeral DB teardown.
|
|
15
|
+
const pool = getPgPool(config);
|
|
12
16
|
const basePreset = {
|
|
13
17
|
extends: [ConstructivePreset],
|
|
14
18
|
pgServices: [
|
|
15
19
|
makePgService({
|
|
16
|
-
|
|
20
|
+
pool,
|
|
17
21
|
schemas,
|
|
18
22
|
}),
|
|
19
23
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-schema",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Build GraphQL SDL from PostgreSQL databases using PostGraphile v5",
|
|
6
6
|
"main": "index.js",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"introspection",
|
|
51
51
|
"constructive"
|
|
52
52
|
],
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "3e1b10aecabf7ec90b349dc135b7e5ab70e39cb6"
|
|
54
54
|
}
|