lib/dynamodb/table_actions.rb in dynamodb-ruby-0.3.0 vs lib/dynamodb/table_actions.rb in dynamodb-ruby-0.4.0
- old
+ new
@@ -44,13 +44,19 @@
def list_tables
client.list_tables.table_names
end
def delete_table(_table_name)
+ # To prevent accidentally deleting tables in production
+ raise 'Can not delete tables' unless Dynamodb.configuration.can_delete_tables
+
client.delete_table(table_name: _table_name)
end
def create_table(_table_name, options)
+ # To prevent accidentally deleting tables in production
+ raise 'Can not create tables' unless Dynamodb.configuration.can_create_tables
+
resource.create_table(
{
table_name: _table_name,
provisioned_throughput: {
read_capacity_units: 5,