@gobing-ai/ts-db 0.3.18 → 0.3.20
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/dist/migrate.d.ts.map +1 -1
- package/dist/migrate.js +8 -5
- package/package.json +3 -3
- package/src/migrate.ts +8 -5
package/dist/migrate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,yDAAyD;IACzD,MAAM,CAAC,EAAE,eAAe,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,yDAAyD;IACzD,MAAM,CAAC,EAAE,eAAe,CAAC;CAC5B;AA+ED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDnG"}
|
package/dist/migrate.js
CHANGED
|
@@ -27,10 +27,11 @@ function validateMigrationTableName(table) {
|
|
|
27
27
|
* Each migration is executed with adapter.exec() for file-based or adapter.run() for journal tracking.
|
|
28
28
|
*/
|
|
29
29
|
async function applyEmbeddedMigrations(adapter, journalTable, logger) {
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
// The caller (`applyMigrations`) already ran the journal name through
|
|
31
|
+
// `validateMigrationTableName`; re-validate with the same rule so a custom but
|
|
32
|
+
// legal name (e.g. `my_migrations`) isn't rejected here while the file-based path
|
|
33
|
+
// accepted it — one validator, no divergence between the two migration paths.
|
|
34
|
+
validateMigrationTableName(journalTable);
|
|
34
35
|
// Get already-applied hashes
|
|
35
36
|
const appliedHashes = new Set();
|
|
36
37
|
try {
|
|
@@ -101,7 +102,9 @@ export async function applyMigrations(adapter, options) {
|
|
|
101
102
|
logger.info(`Applying database migrations from ${folder}`);
|
|
102
103
|
await drizzleMigrate(adapter.getDrizzleDb(), {
|
|
103
104
|
migrationsFolder: folder,
|
|
104
|
-
|
|
105
|
+
// Pass the validated `table`, not the raw option — keep one validated
|
|
106
|
+
// name flowing to both the file-based migrator and the embedded fallback.
|
|
107
|
+
...(options?.migrationsTable !== undefined ? { migrationsTable: table } : {}),
|
|
105
108
|
});
|
|
106
109
|
logger.info('Database migrations complete');
|
|
107
110
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-db",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "@gobing-ai/ts-db — a drizzle-free database facade: typed DAOs over Bun SQLite / Cloudflare D1, a small predicate query spec, single-source-of-truth tables, and migrations. Drizzle stays an internal detail.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-db-v<version> && git push --tags' && exit 1"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@gobing-ai/ts-runtime": "^0.3.
|
|
70
|
-
"@gobing-ai/ts-utils": "^0.3.
|
|
69
|
+
"@gobing-ai/ts-runtime": "^0.3.20",
|
|
70
|
+
"@gobing-ai/ts-utils": "^0.3.20"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"drizzle-orm": ">=0.38.0",
|
package/src/migrate.ts
CHANGED
|
@@ -66,10 +66,11 @@ async function applyEmbeddedMigrations(
|
|
|
66
66
|
journalTable: string,
|
|
67
67
|
logger: MigrationLogger,
|
|
68
68
|
): Promise<void> {
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
// The caller (`applyMigrations`) already ran the journal name through
|
|
70
|
+
// `validateMigrationTableName`; re-validate with the same rule so a custom but
|
|
71
|
+
// legal name (e.g. `my_migrations`) isn't rejected here while the file-based path
|
|
72
|
+
// accepted it — one validator, no divergence between the two migration paths.
|
|
73
|
+
validateMigrationTableName(journalTable);
|
|
73
74
|
// Get already-applied hashes
|
|
74
75
|
const appliedHashes = new Set<string>();
|
|
75
76
|
try {
|
|
@@ -152,7 +153,9 @@ export async function applyMigrations(adapter: DbAdapter, options?: MigrationOpt
|
|
|
152
153
|
|
|
153
154
|
await drizzleMigrate(adapter.getDrizzleDb(), {
|
|
154
155
|
migrationsFolder: folder,
|
|
155
|
-
|
|
156
|
+
// Pass the validated `table`, not the raw option — keep one validated
|
|
157
|
+
// name flowing to both the file-based migrator and the embedded fallback.
|
|
158
|
+
...(options?.migrationsTable !== undefined ? { migrationsTable: table } : {}),
|
|
156
159
|
});
|
|
157
160
|
logger.info('Database migrations complete');
|
|
158
161
|
return;
|