@zintrust/d1-migrator 0.4.5 → 0.4.27
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/build-manifest.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/d1-migrator",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"buildDate": "2026-03-
|
|
3
|
+
"version": "0.4.6",
|
|
4
|
+
"buildDate": "2026-03-26T14:37:09.731Z",
|
|
5
5
|
"buildEnvironment": {
|
|
6
6
|
"node": "v22.22.1",
|
|
7
7
|
"platform": "darwin",
|
|
8
8
|
"arch": "arm64"
|
|
9
9
|
},
|
|
10
10
|
"git": {
|
|
11
|
-
"commit": "
|
|
12
|
-
"branch": "
|
|
11
|
+
"commit": "94caf69e",
|
|
12
|
+
"branch": "dev"
|
|
13
13
|
},
|
|
14
14
|
"package": {
|
|
15
15
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"files": {
|
|
30
30
|
"build-manifest.json": {
|
|
31
31
|
"size": 5804,
|
|
32
|
-
"sha256": "
|
|
32
|
+
"sha256": "1a153aa3e004070aed4f7808720ef934e5c668a128cb293efe8fc6998156b4a1"
|
|
33
33
|
},
|
|
34
34
|
"cli/DataMigrator.d.ts": {
|
|
35
35
|
"size": 3355,
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
},
|
|
38
38
|
"cli/DataMigrator.d.ts.map": {
|
|
39
39
|
"size": 2120,
|
|
40
|
-
"sha256": "
|
|
40
|
+
"sha256": "6fb9eade2112a8985f9a86ecf5bd3c4a5cc9504fabb55b75ee43ad000e27226d"
|
|
41
41
|
},
|
|
42
42
|
"cli/DataMigrator.js": {
|
|
43
|
-
"size":
|
|
44
|
-
"sha256": "
|
|
43
|
+
"size": 18347,
|
|
44
|
+
"sha256": "7325cdb942ee70b1cdfa584f386c9b1081178ef07ad937779dfae87979b627f8"
|
|
45
45
|
},
|
|
46
46
|
"cli/MigrateToD1Command.d.ts": {
|
|
47
47
|
"size": 1589,
|
|
48
48
|
"sha256": "c1bffb405e91cc1ff61507a51bf80baaeb89ce5a1a98ae591ecaa8e35450a8d2"
|
|
49
49
|
},
|
|
50
50
|
"cli/MigrateToD1Command.d.ts.map": {
|
|
51
|
-
"size":
|
|
52
|
-
"sha256": "
|
|
51
|
+
"size": 1233,
|
|
52
|
+
"sha256": "884676d4ce94415255ec848e8466efa2d69265c3ad015b4b287fea7f4fc16a37"
|
|
53
53
|
},
|
|
54
54
|
"cli/MigrateToD1Command.js": {
|
|
55
|
-
"size":
|
|
56
|
-
"sha256": "
|
|
55
|
+
"size": 28588,
|
|
56
|
+
"sha256": "07dce8e69a7a328bcf058fd002d468998593d46ae09cc00913cbb512486f4cfd"
|
|
57
57
|
},
|
|
58
58
|
"cli/ProgressTracker.d.ts": {
|
|
59
59
|
"size": 942,
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"sha256": "685c4e8b49c8a86f53feacb7c42e3b8268b9402ae3ae7e47cb46e7b78a9bf78b"
|
|
89
89
|
},
|
|
90
90
|
"index.js": {
|
|
91
|
-
"size":
|
|
92
|
-
"sha256": "
|
|
91
|
+
"size": 1262,
|
|
92
|
+
"sha256": "d6350a9e6bff776ea2eb44370180a29cee46c2951ca3077fe21d0728ef41c48c"
|
|
93
93
|
},
|
|
94
94
|
"register.d.ts": {
|
|
95
95
|
"size": 159,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataMigrator.d.ts","sourceRoot":"","sources":["../../src/cli/DataMigrator.ts"],"names":[],"mappings":"AACA;;;GAGG;AAWH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,O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G;+BAC8B,gBAAgB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC;IAiBpF;;OAEG;wBAEM,SAAS,oBACE,gBAAgB,oBAChB,gBAAgB,UAC1B,eAAe,GACtB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IA4EtD;;OAEG;oCAEiB,gBAAgB,aACvB,MAAM,UACT,MAAM,aACH,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAkBrC;;OAEG;yBAEM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,aACrB,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IA4CrC;;OAEG;iCAEiB,gBAAgB,aACvB,MAAM,QACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAC9B,OAAO,CAAC,MAAM,CAAC;IAkClB;;OAEG;gCACyB,eAAe,CAAC,cAAc,CAAC,aAAa,MAAM,GAAG,MAAM;IAavF;;OAEG;wCAEM,MAAM,UACL,MAAM,gBACA,MAAM,gBACN,MAAM,GACnB,0BAA0B;IAS7B;;OAEG;gCACyB,MAAM,GAAG,iBAAiB;IAetD;;OAEG;6BAES,iBAAiB,WAClB,OAAO,CAAC,iBAAiB,CAAC,GAClC,iBAAiB;EAGpB,CAAC"}
|
package/dist/cli/DataMigrator.js
CHANGED
|
@@ -98,15 +98,14 @@ export const DataMigrator = Object.freeze({
|
|
|
98
98
|
// Migrate each table sequentially for reliable D1/SQLite writes
|
|
99
99
|
Logger.info('Starting table migration...');
|
|
100
100
|
for (const table of schema.tables) {
|
|
101
|
-
Logger.info(`Migrating table: ${table.name}`);
|
|
102
101
|
const result = await DataMigrator.migrateTable(table, sourceConnection, targetConnection, config);
|
|
103
102
|
progress.processedRows += result.rowsMigrated;
|
|
104
103
|
// Add any errors to progress
|
|
105
104
|
if (result.errors.length > 0) {
|
|
106
105
|
progress.errors[table.name] = result.errors.join('; ');
|
|
107
106
|
}
|
|
108
|
-
Logger.info(`Table ${table.name} completed: ${result.rowsMigrated} rows migrated`);
|
|
109
107
|
}
|
|
108
|
+
progress.totalRows = Math.max(progress.totalRows, progress.processedRows);
|
|
110
109
|
// Update final percentage
|
|
111
110
|
progress.percentage =
|
|
112
111
|
progress.totalRows > 0
|
|
@@ -195,6 +194,10 @@ export const DataMigrator = Object.freeze({
|
|
|
195
194
|
const projectRoot = process.cwd();
|
|
196
195
|
const resolvedTarget = LocalD1Resolver.resolveD1Binding(projectRoot, config.targetDatabase);
|
|
197
196
|
const d1LocalPath = await LocalD1Resolver.resolveLocalD1SqlitePath(projectRoot, config.targetDatabase);
|
|
197
|
+
const bindingName = resolvedTarget.config.binding?.trim();
|
|
198
|
+
const configuredDatabaseName = resolvedTarget.config.database_name?.trim();
|
|
199
|
+
Logger.info(`[DataMigrator] Using resolved local D1 target (${resolvedTarget.matchedBy}): database_name=${configuredDatabaseName || 'n/a'}, binding=${bindingName || 'n/a'}`);
|
|
200
|
+
Logger.info(`[DataMigrator] Using resolved local D1 SQLite path: ${d1LocalPath}`);
|
|
198
201
|
const d1Local = SQLiteAdapter.create({ driver: 'sqlite', database: d1LocalPath });
|
|
199
202
|
try {
|
|
200
203
|
await d1Local.connect();
|
|
@@ -277,8 +280,9 @@ export const DataMigrator = Object.freeze({
|
|
|
277
280
|
rowsMigrated += insertedRows;
|
|
278
281
|
// Log progress for large tables
|
|
279
282
|
if (totalRows > 10000 && rowsMigrated % (batchSize * 10) === 0) {
|
|
280
|
-
const
|
|
281
|
-
|
|
283
|
+
const normalizedTotalRows = Math.max(totalRows, rowsMigrated);
|
|
284
|
+
const percentage = Math.round((rowsMigrated / normalizedTotalRows) * 100);
|
|
285
|
+
Logger.info(`Table ${table.name}: ${rowsMigrated}/${normalizedTotalRows} (${percentage}%)`);
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateToD1Command.d.ts","sourceRoot":"","sources":["../../src/cli/MigrateToD1Command.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAOhD,KAAK,iBAAiB,GAAG;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,IAAI,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B,CAAC;
|
|
1
|
+
{"version":3,"file":"MigrateToD1Command.d.ts","sourceRoot":"","sources":["../../src/cli/MigrateToD1Command.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAOhD,KAAK,iBAAiB,GAAG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intrust/core';
|
|
5
|
+
import { ErrorFactory, Logger, WranglerConfig } from '@zintrust/core';
|
|
6
6
|
import { BaseCommand } from '@zintrust/core/cli';
|
|
7
7
|
import { SchemaBuilder } from '../schema/SchemaBuilder.js';
|
|
8
8
|
import { SchemaValidator } from '../schema/Validator.js';
|
|
@@ -47,8 +47,43 @@ const TARGET_DATABASE_ENV_KEYS = Object.freeze([
|
|
|
47
47
|
'D1_TARGET_DB',
|
|
48
48
|
'D1_DATABASE',
|
|
49
49
|
'D1_DATABASE_ID',
|
|
50
|
-
'DB_DATABASE',
|
|
51
50
|
]);
|
|
51
|
+
const describeConfiguredD1Target = (config) => {
|
|
52
|
+
const parts = [];
|
|
53
|
+
if (typeof config.database_name === 'string' && config.database_name.trim() !== '') {
|
|
54
|
+
parts.push(`database_name=${config.database_name.trim()}`);
|
|
55
|
+
}
|
|
56
|
+
if (typeof config.binding === 'string' && config.binding.trim() !== '') {
|
|
57
|
+
parts.push(`binding=${config.binding.trim()}`);
|
|
58
|
+
}
|
|
59
|
+
return parts.length > 0 ? parts.join(', ') : 'unnamed-d1-entry';
|
|
60
|
+
};
|
|
61
|
+
const describeConfiguredD1Targets = (configured) => {
|
|
62
|
+
const rendered = configured
|
|
63
|
+
.map((config) => describeConfiguredD1Target(config))
|
|
64
|
+
.filter((entry) => entry.length > 0);
|
|
65
|
+
return rendered.length > 0 ? rendered.join(' | ') : 'none';
|
|
66
|
+
};
|
|
67
|
+
const getResolvedDefaultTargetName = (projectRoot) => {
|
|
68
|
+
const resolvedName = WranglerConfig.getDefaultD1DatabaseName(projectRoot);
|
|
69
|
+
if (typeof resolvedName === 'string' && resolvedName.trim() !== '') {
|
|
70
|
+
return resolvedName.trim();
|
|
71
|
+
}
|
|
72
|
+
throw ErrorFactory.createValidationError('Resolved Wrangler D1 target is missing both database_name and binding');
|
|
73
|
+
};
|
|
74
|
+
const createTargetDatabaseResolutionError = (target, resolution) => {
|
|
75
|
+
const configuredTargets = describeConfiguredD1Targets(resolution.configured);
|
|
76
|
+
if (resolution.status === 'ambiguous') {
|
|
77
|
+
if (target === undefined || resolution.matchedBy === 'multiple-configured') {
|
|
78
|
+
return ErrorFactory.createValidationError(`Target D1 database is required because multiple Wrangler D1 targets are configured. Re-run with --target-database <database_name|binding> or set D1_TARGET_DB. Configured D1 targets: ${configuredTargets}`);
|
|
79
|
+
}
|
|
80
|
+
return ErrorFactory.createValidationError(`Target D1 database "${target}" is ambiguous by ${resolution.matchedBy}. Matching entries: ${describeConfiguredD1Targets(resolution.matches)}. Re-run with a unique binding via --target-database <binding> or set D1_TARGET_DB. Configured D1 targets: ${configuredTargets}`);
|
|
81
|
+
}
|
|
82
|
+
if (target === undefined) {
|
|
83
|
+
return ErrorFactory.createValidationError(`Target D1 database could not be inferred because no default Wrangler D1 target could be resolved. Re-run with --target-database <database_name|binding> or set D1_TARGET_DB. Configured D1 targets: ${configuredTargets}`);
|
|
84
|
+
}
|
|
85
|
+
return ErrorFactory.createValidationError(`Unable to resolve target D1 database "${target}". Tried database_name first, then binding. Configured D1 targets: ${configuredTargets}`);
|
|
86
|
+
};
|
|
52
87
|
const readOptionString = (options, keys) => {
|
|
53
88
|
for (const key of keys) {
|
|
54
89
|
const optionValue = options[key];
|
|
@@ -255,15 +290,22 @@ const resolveTargetType = (options) => {
|
|
|
255
290
|
return targetType ?? 'd1';
|
|
256
291
|
};
|
|
257
292
|
const resolveTargetDatabase = (options) => {
|
|
293
|
+
const projectRoot = process.cwd();
|
|
258
294
|
const fromOption = readOptionString(options, ['target-database', 'targetDatabase']);
|
|
259
|
-
if (fromOption !== undefined) {
|
|
260
|
-
return fromOption;
|
|
261
|
-
}
|
|
262
295
|
const fromEnv = readEnvString(TARGET_DATABASE_ENV_KEYS);
|
|
263
|
-
|
|
264
|
-
|
|
296
|
+
const explicitTarget = fromOption ?? fromEnv;
|
|
297
|
+
if (explicitTarget !== undefined) {
|
|
298
|
+
const resolution = WranglerConfig.resolveD1Database(projectRoot, explicitTarget);
|
|
299
|
+
if (resolution.status !== 'resolved') {
|
|
300
|
+
throw createTargetDatabaseResolutionError(explicitTarget, resolution);
|
|
301
|
+
}
|
|
302
|
+
return explicitTarget;
|
|
303
|
+
}
|
|
304
|
+
const resolution = WranglerConfig.resolveD1Database(projectRoot);
|
|
305
|
+
if (resolution.status === 'resolved') {
|
|
306
|
+
return getResolvedDefaultTargetName(projectRoot);
|
|
265
307
|
}
|
|
266
|
-
|
|
308
|
+
throw createTargetDatabaseResolutionError(undefined, resolution);
|
|
267
309
|
};
|
|
268
310
|
const resolveMigrationConfig = (options) => {
|
|
269
311
|
const sourceDriver = resolveSourceDriver(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/d1-migrator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.27",
|
|
4
|
+
"description": "Resumable database migration toolkit for moving data to Cloudflare D1 with ZinTrust.",
|
|
4
5
|
"private": false,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "./dist/index.js",
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"node": ">=20.0.0"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
|
-
"@zintrust/core": "^0.4.
|
|
26
|
+
"@zintrust/core": "^0.4.27"
|
|
26
27
|
},
|
|
27
28
|
"publishConfig": {
|
|
28
29
|
"access": "public"
|
|
@@ -39,10 +40,10 @@
|
|
|
39
40
|
"prepublishOnly": "npm run build"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@zintrust/db-mysql": "0.4.
|
|
43
|
-
"@zintrust/db-postgres": "0.4.
|
|
44
|
-
"@zintrust/db-sqlite": "0.4.
|
|
45
|
-
"@zintrust/db-sqlserver": "0.4.
|
|
46
|
-
"@zintrust/db-d1": "0.4.
|
|
43
|
+
"@zintrust/db-mysql": "0.4.4",
|
|
44
|
+
"@zintrust/db-postgres": "0.4.4",
|
|
45
|
+
"@zintrust/db-sqlite": "0.4.4",
|
|
46
|
+
"@zintrust/db-sqlserver": "0.4.4",
|
|
47
|
+
"@zintrust/db-d1": "0.4.4"
|
|
47
48
|
}
|
|
48
49
|
}
|