genbox 1.0.66 → 1.0.67
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/commands/db-sync.js +15 -4
- package/dist/commands/rebuild.js +4 -3
- package/package.json +1 -1
package/dist/commands/db-sync.js
CHANGED
|
@@ -227,10 +227,7 @@ exports.dbSyncCommand
|
|
|
227
227
|
uploadSpinner.succeed(chalk_1.default.green('Database snapshot uploaded'));
|
|
228
228
|
snapshotId = snapshotResult.snapshotId;
|
|
229
229
|
snapshotS3Key = snapshotResult.s3Key;
|
|
230
|
-
//
|
|
231
|
-
if (!options.dump) {
|
|
232
|
-
(0, db_utils_1.cleanupDump)(localDumpPath);
|
|
233
|
-
}
|
|
230
|
+
// Don't cleanup yet - we still need the file for SCP to genbox
|
|
234
231
|
}
|
|
235
232
|
else {
|
|
236
233
|
uploadSpinner.fail(chalk_1.default.red('Database snapshot upload failed'));
|
|
@@ -261,6 +258,9 @@ exports.dbSyncCommand
|
|
|
261
258
|
if (!uploadResult.success) {
|
|
262
259
|
restoreSpinner.fail(chalk_1.default.red('Upload failed'));
|
|
263
260
|
console.error(chalk_1.default.red(` Error: ${uploadResult.error}`));
|
|
261
|
+
if (localDumpPath && !options.dump) {
|
|
262
|
+
(0, db_utils_1.cleanupDump)(localDumpPath);
|
|
263
|
+
}
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
restoreSpinner.text = 'Restoring database...';
|
|
@@ -271,15 +271,26 @@ exports.dbSyncCommand
|
|
|
271
271
|
if (!restoreResult.success) {
|
|
272
272
|
restoreSpinner.fail(chalk_1.default.red('Restore failed'));
|
|
273
273
|
console.error(chalk_1.default.red(` Error: ${restoreResult.error}`));
|
|
274
|
+
if (localDumpPath && !options.dump) {
|
|
275
|
+
(0, db_utils_1.cleanupDump)(localDumpPath);
|
|
276
|
+
}
|
|
274
277
|
return;
|
|
275
278
|
}
|
|
276
279
|
restoreSpinner.succeed(chalk_1.default.green('Database sync completed!'));
|
|
277
280
|
console.log('');
|
|
278
281
|
console.log(chalk_1.default.dim(` Database has been restored from ${source} snapshot.`));
|
|
282
|
+
// Cleanup local dump file now that we're done
|
|
283
|
+
if (localDumpPath && !options.dump) {
|
|
284
|
+
(0, db_utils_1.cleanupDump)(localDumpPath);
|
|
285
|
+
}
|
|
279
286
|
}
|
|
280
287
|
catch (error) {
|
|
281
288
|
restoreSpinner.fail(chalk_1.default.red('Database restore failed'));
|
|
282
289
|
console.error(chalk_1.default.red(` Error: ${error.message}`));
|
|
290
|
+
// Cleanup on error too
|
|
291
|
+
if (localDumpPath && !options.dump) {
|
|
292
|
+
(0, db_utils_1.cleanupDump)(localDumpPath);
|
|
293
|
+
}
|
|
283
294
|
}
|
|
284
295
|
}
|
|
285
296
|
catch (error) {
|
package/dist/commands/rebuild.js
CHANGED
|
@@ -562,9 +562,10 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
|
|
|
562
562
|
// For branch: CLI options override, then stored newBranch (if it was created), then stored branch
|
|
563
563
|
const effectiveBranch = options.branch || storedNewBranch || storedBranch;
|
|
564
564
|
// For new branch creation: use CLI options OR stored values (to re-create branch if first attempt failed)
|
|
565
|
-
// If storedNewBranch exists
|
|
566
|
-
const
|
|
567
|
-
const
|
|
565
|
+
// If storedNewBranch exists, we need to re-create it - default sourceBranch to 'main' if not stored
|
|
566
|
+
const defaultSourceBranch = config.defaults?.branch || 'main';
|
|
567
|
+
const effectiveNewBranch = newBranchName || storedNewBranch;
|
|
568
|
+
const effectiveSourceBranch = options.fromBranch || (storedNewBranch ? (storedSourceBranch || defaultSourceBranch) : undefined);
|
|
568
569
|
// For database: use CLI option, or stored database config (convert 'snapshot' to 'copy')
|
|
569
570
|
const storedDbMode = genbox.database?.mode === 'snapshot' ? 'copy' : genbox.database?.mode;
|
|
570
571
|
const effectiveDbMode = options.db || storedDbMode;
|