Skip to content

Commit 429d840

Browse files
authored
Merge pull request #53 from circles-learning-labs/issue_48
Fix BillingModeSummary issue that affected migrations
2 parents 2e44046 + f16adfa commit 429d840

File tree

4 files changed

+1
-8
lines changed

4 files changed

+1
-8
lines changed

lib/ecto_adapters_dynamodb/migration.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ defmodule Ecto.Adapters.DynamoDB.Migration do
331331
# that attempt to add an index to a provisioned table without specifying throughput. The problem doesn't exist
332332
# the other way around; local Dynamo will ignore throughput specified for indexes where the table is on-demand.
333333
defp maybe_default_throughput_local(_using_ddb_local, data, table_info) do
334-
if table_info["BillingModeSummary"]["BillingMode"] == "PROVISIONED" do
334+
if not Map.has_key?(table_info, "BillingModeSummary") or table_info["BillingModeSummary"]["BillingMode"] == "PROVISIONED" do
335335
updated_global_secondary_index_updates =
336336
for index_update <- data.global_secondary_index_updates, {action, index_info} <- index_update do
337337
if action in [:create, :update] do

test/ecto_adapters_dynamodb/info_test.exs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ defmodule Ecto.Adapters.DynamoDB.Info.Test do
1414
%{"AttributeName" => "mass", "AttributeType" => "N"},
1515
%{"AttributeName" => "name", "AttributeType" => "S"}
1616
],
17-
"BillingModeSummary" => %{
18-
"BillingMode" => "PROVISIONED",
19-
"LastUpdateToPayPerRequestDateTime" => 0.0
20-
},
2117
"GlobalSecondaryIndexes" => [
2218
%{
2319
"IndexArn" => "arn:aws:dynamodb:ddblocal:000000000000:table/test_planet/index/name_mass",

test/ecto_adapters_dynamodb/migration_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ defmodule Ecto.Adapters.DynamoDB.Migration.Test do
3838

3939
test "create: provisioned table" do
4040
result = Ecto.Migrator.run(TestRepo, @migration_path, :up, step: 1)
41-
table_info = Ecto.Adapters.DynamoDB.Info.table_info("cat")
4241

4342
assert length(result) == 1
44-
assert table_info["BillingModeSummary"]["BillingMode"] == "PROVISIONED"
4543
end
4644

4745
test "alter table: add index to on-demand table" do

test/integration/ex_aws_dynamo_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ defmodule Ecto.Adapters.DynamoDB.Integration.ExAws.Dynamo.Test do
1414
{:ok, table_info} = ExAws.Dynamo.describe_table(@ex_aws_dynamo_test_table_name) |> ExAws.request()
1515

1616
assert table_info["Table"]["TableName"] == @ex_aws_dynamo_test_table_name
17-
assert table_info["Table"]["BillingModeSummary"]["BillingMode"] == "PROVISIONED"
1817
end
1918

2019
test "update_table" do

0 commit comments

Comments
 (0)