@jskit-ai/database-runtime-postgres 0.1.249 → 0.1.251
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 +3 -3
- package/patterns/postgres-application/PATTERN.md +16 -5
- package/patterns/postgres-application/example/knexfile.js +2 -2
- package/patterns/postgres-application/example/package.json +1 -1
- package/patterns/postgres-application/example/scripts/prepare-database.js +1 -1
- package/src/server/providers/PostgresDatabaseDriverProvider.js +2 -2
- package/src/shared/dialect.js +1 -5
- package/src/shared/index.js +1 -1
- package/test/entrypoints.boundary.test.js +0 -1
- package/test/providerRuntime.test.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/database-runtime-postgres",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.251",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test --test-concurrency=1"
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"./shared/dialect": "./src/shared/dialect.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
15
|
+
"@jskit-ai/database-runtime": "0.1.254",
|
|
16
16
|
"pg": "^8.13.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@jskit-ai/kernel": "0.2.
|
|
19
|
+
"@jskit-ai/kernel": "0.2.5"
|
|
20
20
|
},
|
|
21
21
|
"jskit": {
|
|
22
22
|
"kind": "runtime",
|
|
@@ -38,7 +38,10 @@ decisions, not framework questions.
|
|
|
38
38
|
## Framework APIs
|
|
39
39
|
|
|
40
40
|
Use `createKnexMigrationConfigFromApp()` from
|
|
41
|
-
`@jskit-ai/database-runtime/server/knexMigrationConfig
|
|
41
|
+
`@jskit-ai/database-runtime/server/knexMigrationConfig`, and
|
|
42
|
+
`prepareDatabaseFromApp()` from `@jskit-ai/database-runtime/server/databaseSetup`.
|
|
43
|
+
Both take the dialect and the application's environment
|
|
44
|
+
(`environment: process.env`), which they never read on their own. The running JSKIT
|
|
42
45
|
application automatically selects the sole installed database driver, while
|
|
43
46
|
Knex discovers package-owned migrations from the installed dependency graph.
|
|
44
47
|
|
|
@@ -50,6 +53,14 @@ dialect. `example/scripts/prepare-database.js` is the portable
|
|
|
50
53
|
migrate-then-seed entrypoint for managed sessions and deployments.
|
|
51
54
|
`example/.env.example` names the five connection values without a secret.
|
|
52
55
|
|
|
56
|
+
`example/.github/workflows/verify.yml` is a normal app-owned CI workflow with
|
|
57
|
+
exactly one database service: `postgres` (`postgres:17`, `POSTGRES_*`
|
|
58
|
+
variables, port `5432`, a `pg_isready` health check). Copy it whole from this
|
|
59
|
+
pattern and adapt it as source rather than generating it from package metadata.
|
|
60
|
+
Do not combine it with the MySQL pattern's workflow: a PostgreSQL application's
|
|
61
|
+
workflow has no `mariadb` service, `MARIADB_*` variables, port `3306`, or
|
|
62
|
+
`healthcheck.sh` option.
|
|
63
|
+
|
|
53
64
|
## Variation points
|
|
54
65
|
|
|
55
66
|
Change scripts, migration location, connection values, and secret injection to
|
|
@@ -66,10 +77,9 @@ it as `seed` to `prepareDatabaseFromApp()`.
|
|
|
66
77
|
- Run `npm run db:migrate:status` and the application verification command.
|
|
67
78
|
- Exercise one transaction and one negative connection case.
|
|
68
79
|
- When a seed exists, run `db:prepare` twice and require the second run to be safe.
|
|
69
|
-
|
|
70
|
-
`
|
|
71
|
-
|
|
72
|
-
from package metadata.
|
|
80
|
+
- Confirm `.github/workflows/verify.yml` parses as YAML and declares only the
|
|
81
|
+
`postgres` service. GitHub reports an unparseable workflow only as a failed
|
|
82
|
+
run with "no jobs were run".
|
|
73
83
|
|
|
74
84
|
## Avoid
|
|
75
85
|
|
|
@@ -77,4 +87,5 @@ from package metadata.
|
|
|
77
87
|
- generated `.env` secrets
|
|
78
88
|
- depending on a live schema as the source contract
|
|
79
89
|
- a second driver installed “just in case”
|
|
90
|
+
- any file, service, port, or variable copied from the MySQL pattern
|
|
80
91
|
- migration receipts, provenance, replay logs, or generator ownership
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createKnexMigrationConfigFromApp } from "@jskit-ai/database-runtime/server/knexMigrationConfig";
|
|
2
2
|
|
|
3
3
|
try {
|
|
4
|
-
process.loadEnvFile
|
|
4
|
+
process.loadEnvFile(".env");
|
|
5
5
|
} catch (error) {
|
|
6
6
|
if (error?.code !== "ENOENT") {
|
|
7
7
|
throw error;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export default await createKnexMigrationConfigFromApp({ client: "pg" });
|
|
11
|
+
export default await createKnexMigrationConfigFromApp({ client: "pg", environment: process.env });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineProvider } from "@jskit-ai/kernel/shared/capabilities";
|
|
2
|
-
import
|
|
2
|
+
import { DIALECT_ID } from "../../shared/index.js";
|
|
3
3
|
|
|
4
4
|
const PostgresDatabaseDriverProvider = defineProvider({
|
|
5
5
|
id: "runtime.database.driver.postgres",
|
|
@@ -8,7 +8,7 @@ const PostgresDatabaseDriverProvider = defineProvider({
|
|
|
8
8
|
},
|
|
9
9
|
setup() {
|
|
10
10
|
return {
|
|
11
|
-
driver: Object.freeze({
|
|
11
|
+
driver: Object.freeze({ DIALECT_ID })
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
});
|
package/src/shared/dialect.js
CHANGED
package/src/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DIALECT_ID
|
|
1
|
+
export { DIALECT_ID } from "./dialect.js";
|
|
@@ -28,6 +28,5 @@ test("server provider module exports the declarative postgres driver provider",
|
|
|
28
28
|
|
|
29
29
|
test("shared entrypoint exports postgres dialect helpers", () => {
|
|
30
30
|
assert.equal(sharedApi.DIALECT_ID, "pg");
|
|
31
|
-
assert.equal(sharedApi.getDialectId(), "pg");
|
|
32
31
|
assert.equal(typeof sharedApi.PostgresDatabaseDriverProvider, "undefined");
|
|
33
32
|
});
|