Skip to content

Commit

Permalink
fix(dynamodb): cannot reuse container since table already exists (#176)
Browse files Browse the repository at this point in the history
Now since the container might be reused across simulator updates, we need to make sure we clean up the table before it's being created.

I've tested this manually because I am not sure how to test this.
  • Loading branch information
eladb authored Apr 2, 2024
1 parent 78bcb28 commit 3e335d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions dynamodb/dynamodb.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ pub class Table_sim impl dynamodb_types.ITable {
return nil;
})();

// delete the table if it already exists because we might be reusing the container
try { client.deleteTable({ TableName: tableName }); }
catch e { }

util.waitUntil(() => {
try {
client.createTable({
Expand Down
2 changes: 1 addition & 1 deletion dynamodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/dynamodb",
"version": "0.1.0",
"version": "0.1.1",
"description": "DynamoDB library for Wing",
"author": {
"name": "Cristian Pallarés",
Expand Down

0 comments on commit 3e335d4

Please sign in to comment.