diff --git a/lib/dynamo-restore.js b/lib/dynamo-restore.js index b341fb8..1bff915 100755 --- a/lib/dynamo-restore.js +++ b/lib/dynamo-restore.js @@ -106,6 +106,18 @@ DynamoRestore.prototype._checkTableExists = function(error, data) { // Table exists, should we overwrite it?? if (this.options.overwrite) { this.emit('warning', util.format('WARN: table [%s] will be overwritten.', this.options.table)); + params = { + TableName: this.options.table, + ProvisionedThroughput: { + ReadCapacityUnits: this.options.readcapacity, + WriteCapacityUnits: this.options.concurrency + } + }; + dynamodb.updateTable(params, (function(error, data) { + if (error || !data) { + return this.emit('error', 'Fatal Error. Failed to update table. ' + error); + } + }).bind(this)); setTimeout(dynamodb.describeTable.bind(dynamodb, { TableName: this.options.table }, this._checkTableReady.bind(this)), 1000); } else { this.emit('error', 'Fatal Error. The destination table already exists! Exiting process..'); @@ -307,7 +319,7 @@ DynamoRestore.prototype._sendBatch = function() { this.emit('warning', 'Failed to upload same batch too many times, removing from queue.. \n' + JSON.stringify(batch)); } } else { - this.emit('warning', 'Error processing batch, putting back in the queue.'); + this.emit('warning', 'Error processing batch, putting back in the queue: ' + error); batch.attempts++; this.batches.push(batch); }