@jskit-ai/database-runtime-mysql 0.1.259 → 0.1.261
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-mysql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.261",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jskit test"
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"./shared/dialect": "./src/shared/dialect.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@jskit-ai/database-runtime": "0.1.261",
|
|
16
15
|
"mysql2": "^3.11.2"
|
|
17
16
|
},
|
|
18
17
|
"jskit": {
|
|
@@ -56,6 +55,7 @@
|
|
|
56
55
|
}
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
|
-
"@jskit-ai/
|
|
58
|
+
"@jskit-ai/database-runtime": "0.1.263",
|
|
59
|
+
"@jskit-ai/kernel": "0.2.14"
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -11,8 +11,10 @@ requires: @jskit-ai/database-runtime-mysql
|
|
|
11
11
|
## Use when
|
|
12
12
|
|
|
13
13
|
Use this pattern when an application deliberately chooses MySQL or MariaDB.
|
|
14
|
-
Install `@jskit-ai/database-runtime-mysql
|
|
15
|
-
the
|
|
14
|
+
Install `@jskit-ai/database-runtime` and `@jskit-ai/database-runtime-mysql`
|
|
15
|
+
without a package-setup wizard: the runtime brings Knex and the driver brings
|
|
16
|
+
`mysql2`. The driver takes the runtime as a peer, so the application holds its
|
|
17
|
+
one copy.
|
|
16
18
|
|
|
17
19
|
## Do not use when
|
|
18
20
|
|
|
@@ -50,8 +52,11 @@ Knex discovers package-owned migrations from the installed dependency graph.
|
|
|
50
52
|
`example/package.json` contains the runtime dependency and database scripts.
|
|
51
53
|
`example/knexfile.js` loads an optional local `.env` and fixes the MySQL dialect.
|
|
52
54
|
`example/scripts/prepare-database.js` is the portable migrate-then-seed
|
|
53
|
-
entrypoint for managed sessions and deployments.
|
|
54
|
-
the
|
|
55
|
+
entrypoint for managed sessions and deployments. It loads the optional `.env`
|
|
56
|
+
as the knexfile does, and migrates the database `DB_NAME` names without
|
|
57
|
+
creating it: the hosting environment or a database administrator creates it
|
|
58
|
+
first. `example/.env.example` names the connection values and separate test
|
|
59
|
+
databases without a secret.
|
|
55
60
|
|
|
56
61
|
`example/.github/workflows/verify.yml` is a normal app-owned CI workflow with
|
|
57
62
|
exactly one database service: `mariadb` (`mariadb:11.4`, `MARIADB_*`
|
|
@@ -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: "mysql2", environment: process.env });
|