@jskit-ai/database-runtime-postgres 0.1.259 → 0.1.260

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/database-runtime-postgres",
3
- "version": "0.1.259",
3
+ "version": "0.1.260",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -12,11 +12,11 @@
12
12
  "./shared/dialect": "./src/shared/dialect.js"
13
13
  },
14
14
  "dependencies": {
15
- "@jskit-ai/database-runtime": "0.1.262",
16
15
  "pg": "^8.13.1"
17
16
  },
18
17
  "peerDependencies": {
19
- "@jskit-ai/kernel": "0.2.13"
18
+ "@jskit-ai/database-runtime": "0.1.263",
19
+ "@jskit-ai/kernel": "0.2.14"
20
20
  },
21
21
  "jskit": {
22
22
  "kind": "runtime",
@@ -11,8 +11,9 @@ requires: @jskit-ai/database-runtime-postgres
11
11
  ## Use when
12
12
 
13
13
  Use this pattern when an application deliberately chooses PostgreSQL. Install
14
- `@jskit-ai/database-runtime-postgres`; its normal npm dependencies provide the
15
- database runtime, Knex, and `pg` without a package-setup wizard.
14
+ `@jskit-ai/database-runtime` and `@jskit-ai/database-runtime-postgres` without
15
+ a package-setup wizard: the runtime brings Knex and the driver brings `pg`. The
16
+ driver takes the runtime as a peer, so the application holds its one copy.
16
17
 
17
18
  ## Do not use when
18
19
 
@@ -50,8 +51,11 @@ Knex discovers package-owned migrations from the installed dependency graph.
50
51
  `example/package.json` contains the runtime dependency and database scripts.
51
52
  `example/knexfile.js` loads an optional local `.env` and fixes the PostgreSQL
52
53
  dialect. `example/scripts/prepare-database.js` is the portable
53
- migrate-then-seed entrypoint for managed sessions and deployments.
54
- `example/.env.example` names the five connection values without a secret.
54
+ migrate-then-seed entrypoint for managed sessions and deployments. It loads
55
+ the optional `.env` as the knexfile does, and migrates the database `DB_NAME`
56
+ names without creating it: the hosting environment or a database
57
+ administrator creates it first. `example/.env.example` names the five
58
+ connection values without a secret.
55
59
 
56
60
  Tests get their own databases from
57
61
  `@jskit-ai/database-runtime/server/testDatabases`. The `test` script runs
@@ -9,6 +9,7 @@
9
9
  "test": "jskit test --databases"
10
10
  },
11
11
  "dependencies": {
12
- "@jskit-ai/database-runtime-postgres": "0.1.259"
12
+ "@jskit-ai/database-runtime": "0.1.263",
13
+ "@jskit-ai/database-runtime-postgres": "0.1.260"
13
14
  }
14
15
  }
@@ -1,3 +1,11 @@
1
1
  import { prepareDatabaseFromApp } from "@jskit-ai/database-runtime/server/databaseSetup";
2
2
 
3
+ try {
4
+ process.loadEnvFile(".env");
5
+ } catch (error) {
6
+ if (error?.code !== "ENOENT") {
7
+ throw error;
8
+ }
9
+ }
10
+
3
11
  await prepareDatabaseFromApp({ client: "pg", environment: process.env });