diff --git a/lib/commands/stack/import.js b/lib/commands/stack/import.js index c2bffe9..226be80 100644 --- a/lib/commands/stack/import.js +++ b/lib/commands/stack/import.js @@ -56,8 +56,13 @@ const handler = async argv => { if (argv.postSync) { body.post_sync = true; } - } else if (argv.uploadsPath) { - body.uploads_path = argv.uploadsPath; + } else { + if (argv.uploadsPath) { + body.uploads_path = argv.uploadsPath; + } + if (argv.method) { + body.method = argv.method; + } } const data = await fetchJSON(v, `stack/applications/${target}/${route}?stream=true`, { @@ -78,6 +83,7 @@ export default { .option('from', { type: 'string', description: 'Source application id.' }) .option('tables', { type: 'string', description: 'Comma-separated database table names.' }) .option('uploads-path', { type: 'string', description: 'Uploads prefix to import.' }) + .option('method', { type: 'string', choices: ['diff', 'legacy'], description: 'Import method for uploads: diff skips unchanged files, legacy copies everything.' }) .option('replace', { type: 'string', array: true, description: 'Search-replace mapping from=to.' }) .option('use-mydumper', { type: 'boolean', description: 'Use mydumper/myloader.' }) .option('post-sync', { type: 'boolean', description: 'Run post-sync after database import.' }) diff --git a/lib/stream.js b/lib/stream.js index bfd533b..878e5d9 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -45,7 +45,7 @@ export default function(url, opts) { buf = ''; - stream = got.default.stream(url, reqOpts); + stream = got.stream(url, reqOpts); onclose = once(() => { if (destroyed) return;