in lib/aws-record/record/table_migration.rb [62:91]
def create!(opts)
gsit = opts.delete(:global_secondary_index_throughput)
_validate_billing(opts)
create_opts = opts.merge(
table_name: @model.table_name,
attribute_definitions: _attribute_definitions,
key_schema: _key_schema
)
if (lsis = @model.local_secondary_indexes_for_migration)
create_opts[:local_secondary_indexes] = lsis
_append_to_attribute_definitions(lsis, create_opts)
end
if (gsis = @model.global_secondary_indexes_for_migration)
unless gsit || opts[:billing_mode] == 'PAY_PER_REQUEST'
raise ArgumentError, 'If you define global secondary indexes, you must also define ' \
':global_secondary_index_throughput on table creation, ' \
"unless :billing_mode is set to 'PAY_PER_REQUEST'."
end
gsis_opts = if opts[:billing_mode] == 'PAY_PER_REQUEST'
gsis
else
_add_throughput_to_gsis(gsis, gsit)
end
create_opts[:global_secondary_indexes] = gsis_opts
_append_to_attribute_definitions(gsis, create_opts)
end
@client.create_table(create_opts)
end