mysqlsyncr 1.1.6 → 1.1.8
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/index.cjs +5 -5
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/apply.js +5 -5
package/dist/index.cjs
CHANGED
|
@@ -3747,7 +3747,7 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3747
3747
|
}
|
|
3748
3748
|
// Step 1: Add new column
|
|
3749
3749
|
addColumnSQL = "ALTER TABLE `".concat(_tableName2, "` ADD COLUMN `").concat(field.Field, "_new` ").concat(field.Type, " DEFAULT NULL;");
|
|
3750
|
-
|
|
3750
|
+
console.log("Adding new column for type conversion: ".concat(addColumnSQL));
|
|
3751
3751
|
_context.next = 60;
|
|
3752
3752
|
return connection.query(addColumnSQL);
|
|
3753
3753
|
case 60:
|
|
@@ -3770,7 +3770,7 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3770
3770
|
case 71:
|
|
3771
3771
|
totalUpdated += rowsAffected;
|
|
3772
3772
|
batchCount++;
|
|
3773
|
-
|
|
3773
|
+
console.log("Batch ".concat(batchCount, ": Converted ").concat(rowsAffected, " rows. Total converted: ").concat(totalUpdated));
|
|
3774
3774
|
_context.next = 63;
|
|
3775
3775
|
break;
|
|
3776
3776
|
case 76:
|
|
@@ -3783,16 +3783,16 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3783
3783
|
_yield$connection$que2 = _slicedToArray(_yield$connection$que, 1);
|
|
3784
3784
|
verifyResult = _yield$connection$que2[0];
|
|
3785
3785
|
if (verifyResult.mismatch > 0) {
|
|
3786
|
-
|
|
3786
|
+
console.log("Warning: ".concat(verifyResult.mismatch, " rows may have failed conversion"));
|
|
3787
3787
|
}
|
|
3788
3788
|
|
|
3789
3789
|
// Step 4: Swap columns
|
|
3790
3790
|
swapColumnsSQL = "\n ALTER TABLE `".concat(_tableName2, "`\n DROP COLUMN `").concat(field.Field, "`,\n RENAME COLUMN `").concat(field.Field, "_new` TO `").concat(field.Field, "`\n ");
|
|
3791
|
-
|
|
3791
|
+
console.log("Executing: ".concat(swapColumnsSQL));
|
|
3792
3792
|
_context.next = 87;
|
|
3793
3793
|
return connection.query(swapColumnsSQL);
|
|
3794
3794
|
case 87:
|
|
3795
|
-
|
|
3795
|
+
console.log("Completed type conversion for ".concat(field.Field, ". Total rows converted: ").concat(totalUpdated));
|
|
3796
3796
|
_context.next = 98;
|
|
3797
3797
|
break;
|
|
3798
3798
|
case 90:
|
package/dist/index.js
CHANGED
|
@@ -3744,7 +3744,7 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3744
3744
|
}
|
|
3745
3745
|
// Step 1: Add new column
|
|
3746
3746
|
addColumnSQL = "ALTER TABLE `".concat(_tableName2, "` ADD COLUMN `").concat(field.Field, "_new` ").concat(field.Type, " DEFAULT NULL;");
|
|
3747
|
-
|
|
3747
|
+
console.log("Adding new column for type conversion: ".concat(addColumnSQL));
|
|
3748
3748
|
_context.next = 60;
|
|
3749
3749
|
return connection.query(addColumnSQL);
|
|
3750
3750
|
case 60:
|
|
@@ -3767,7 +3767,7 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3767
3767
|
case 71:
|
|
3768
3768
|
totalUpdated += rowsAffected;
|
|
3769
3769
|
batchCount++;
|
|
3770
|
-
|
|
3770
|
+
console.log("Batch ".concat(batchCount, ": Converted ").concat(rowsAffected, " rows. Total converted: ").concat(totalUpdated));
|
|
3771
3771
|
_context.next = 63;
|
|
3772
3772
|
break;
|
|
3773
3773
|
case 76:
|
|
@@ -3780,16 +3780,16 @@ var applyDifferences = /*#__PURE__*/function () {
|
|
|
3780
3780
|
_yield$connection$que2 = _slicedToArray(_yield$connection$que, 1);
|
|
3781
3781
|
verifyResult = _yield$connection$que2[0];
|
|
3782
3782
|
if (verifyResult.mismatch > 0) {
|
|
3783
|
-
|
|
3783
|
+
console.log("Warning: ".concat(verifyResult.mismatch, " rows may have failed conversion"));
|
|
3784
3784
|
}
|
|
3785
3785
|
|
|
3786
3786
|
// Step 4: Swap columns
|
|
3787
3787
|
swapColumnsSQL = "\n ALTER TABLE `".concat(_tableName2, "`\n DROP COLUMN `").concat(field.Field, "`,\n RENAME COLUMN `").concat(field.Field, "_new` TO `").concat(field.Field, "`\n ");
|
|
3788
|
-
|
|
3788
|
+
console.log("Executing: ".concat(swapColumnsSQL));
|
|
3789
3789
|
_context.next = 87;
|
|
3790
3790
|
return connection.query(swapColumnsSQL);
|
|
3791
3791
|
case 87:
|
|
3792
|
-
|
|
3792
|
+
console.log("Completed type conversion for ".concat(field.Field, ". Total rows converted: ").concat(totalUpdated));
|
|
3793
3793
|
_context.next = 98;
|
|
3794
3794
|
break;
|
|
3795
3795
|
case 90:
|
package/package.json
CHANGED
package/src/apply.js
CHANGED
|
@@ -129,7 +129,7 @@ export const applyDifferences = async (connection, database, differences) => {
|
|
|
129
129
|
if (needsBatchProcessing()) {
|
|
130
130
|
// Step 1: Add new column
|
|
131
131
|
const addColumnSQL = `ALTER TABLE \`${tableName}\` ADD COLUMN \`${field.Field}_new\` ${field.Type} DEFAULT NULL;`;
|
|
132
|
-
|
|
132
|
+
console.log(`Adding new column for type conversion: ${addColumnSQL}`);
|
|
133
133
|
await connection.query(addColumnSQL);
|
|
134
134
|
|
|
135
135
|
// Step 2: Copy data in batches
|
|
@@ -152,7 +152,7 @@ export const applyDifferences = async (connection, database, differences) => {
|
|
|
152
152
|
|
|
153
153
|
totalUpdated += rowsAffected;
|
|
154
154
|
batchCount++;
|
|
155
|
-
|
|
155
|
+
console.log(`Batch ${batchCount}: Converted ${rowsAffected} rows. Total converted: ${totalUpdated}`);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// Step 3: Verify data (optional)
|
|
@@ -163,7 +163,7 @@ export const applyDifferences = async (connection, database, differences) => {
|
|
|
163
163
|
`;
|
|
164
164
|
const [verifyResult] = await connection.query(verifySQL);
|
|
165
165
|
if (verifyResult.mismatch > 0) {
|
|
166
|
-
|
|
166
|
+
console.log(`Warning: ${verifyResult.mismatch} rows may have failed conversion`);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// Step 4: Swap columns
|
|
@@ -172,10 +172,10 @@ export const applyDifferences = async (connection, database, differences) => {
|
|
|
172
172
|
DROP COLUMN \`${field.Field}\`,
|
|
173
173
|
RENAME COLUMN \`${field.Field}_new\` TO \`${field.Field}\`
|
|
174
174
|
`;
|
|
175
|
-
|
|
175
|
+
console.log(`Executing: ${swapColumnsSQL}`);
|
|
176
176
|
await connection.query(swapColumnsSQL);
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
console.log(`Completed type conversion for ${field.Field}. Total rows converted: ${totalUpdated}`);
|
|
179
179
|
} else {
|
|
180
180
|
// Original mismatched field handling for simple changes
|
|
181
181
|
const isTimestamp = field.Type.toLowerCase().includes('timestamp');
|