97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/ocean-dynamo/tables.rb', line 97
def create_table
attrs = table_attribute_definitions keys = table_key_schema
options = {
table_name: table_full_name,
attribute_definitions: attrs,
key_schema: keys,
provisioned_throughput: {
read_capacity_units: table_read_capacity_units,
write_capacity_units: table_write_capacity_units
}
}
lsi = local_secondary_indexes.collect { |n| local_secondary_index_declaration n }
options[:local_secondary_indexes] = lsi unless lsi.blank?
gsi = global_secondary_indexes.collect { |k, v| global_secondary_index_declaration k, v }
options[:global_secondary_indexes] = gsi unless gsi.blank?
dynamo_resource.create_table(options)
sleep 1 until dynamo_table.table_status == "ACTIVE"
setup_dynamo
true
end
|