Skip to content

Commit

Permalink
fix the table deletion logic and improve the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
austencollins committed Oct 1, 2019
1 parent 0b87451 commit b004ddb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class AwsDynamoDb extends Component {
if (!equals(prevTable.name, config.name)) {
// If "delete: false", don't delete the table
if (config.delete === false) {
throw new Error('Your table name was changed but the old one cannot be deleted because "delete" is set to false.')
throw new Error(`You're attempting to change your table name from ${this.state.name} to ${config.name} which will result in you deleting your table, but you've specified the "delete" input to "false" which prevents your original table from being deleted.`)
}
await deleteTable({ dynamodb, name: prevTable.name })
config.arn = await createTable({ dynamodb, ...config })
Expand Down
1 change: 1 addition & 0 deletions testProjects/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ name: test-table
table:
component: ../
inputs:
name: test-table
delete: false

0 comments on commit b004ddb

Please sign in to comment.