@jskit-ai/database-runtime 0.1.145 → 0.1.146
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.descriptor.mjs
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,8 @@ import test from "node:test";
|
|
|
3
3
|
import {
|
|
4
4
|
parseDatabaseUrl,
|
|
5
5
|
resolveDatabaseClientFromEnvironment,
|
|
6
|
-
resolveDatabaseConnectionFromEnvironment
|
|
6
|
+
resolveDatabaseConnectionFromEnvironment,
|
|
7
|
+
resolveKnexConnectionFromEnvironment
|
|
7
8
|
} from "../src/shared/databaseConnection.js";
|
|
8
9
|
|
|
9
10
|
test("parseDatabaseUrl parses mysql url fields", () => {
|
|
@@ -71,3 +72,32 @@ test("resolveDatabaseConnectionFromEnvironment returns mutable connection fields
|
|
|
71
72
|
assert.equal(descriptor?.configurable, true);
|
|
72
73
|
assert.equal(descriptor?.writable, true);
|
|
73
74
|
});
|
|
75
|
+
|
|
76
|
+
test("resolveKnexConnectionFromEnvironment keeps only MySQL DATE columns as strings", () => {
|
|
77
|
+
const mysqlConnection = resolveKnexConnectionFromEnvironment({
|
|
78
|
+
DB_CLIENT: "mysql2",
|
|
79
|
+
DB_HOST: "db.local",
|
|
80
|
+
DB_NAME: "appdb",
|
|
81
|
+
DB_USER: "appuser",
|
|
82
|
+
DB_PASSWORD: "apppass"
|
|
83
|
+
}, {
|
|
84
|
+
client: "mysql2"
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
assert.deepEqual(mysqlConnection.dateStrings, ["DATE"]);
|
|
88
|
+
assert.equal(mysqlConnection.supportBigNumbers, true);
|
|
89
|
+
assert.equal(mysqlConnection.bigNumberStrings, true);
|
|
90
|
+
|
|
91
|
+
const postgresConnection = resolveKnexConnectionFromEnvironment({
|
|
92
|
+
DB_CLIENT: "pg",
|
|
93
|
+
DB_HOST: "db.local",
|
|
94
|
+
DB_NAME: "appdb",
|
|
95
|
+
DB_USER: "appuser",
|
|
96
|
+
DB_PASSWORD: "apppass"
|
|
97
|
+
}, {
|
|
98
|
+
client: "pg",
|
|
99
|
+
defaultPort: 5432
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
assert.equal(postgresConnection.dateStrings, undefined);
|
|
103
|
+
});
|
|
@@ -178,6 +178,7 @@ test("DatabaseRuntimeServiceProvider resolves knex from app root package context
|
|
|
178
178
|
assert.equal(knex.__config.connection.database, "appdb");
|
|
179
179
|
assert.equal(knex.__config.connection.user, "appuser");
|
|
180
180
|
assert.equal(knex.__config.connection.password, "apppass");
|
|
181
|
+
assert.deepEqual(knex.__config.connection.dateStrings, ["DATE"]);
|
|
181
182
|
});
|
|
182
183
|
});
|
|
183
184
|
|