class DashOverlord::Models::V1::DynamoDb::Migration
Public Class Methods
new(migration_class)
click to toggle source
# File lib/dash_overlord/models/v1/dynamo_db/migration.rb, line 8 def initialize(migration_class) @client ||= Aws::DynamoDB::Client.new @migration_class = migration_class end
Public Instance Methods
create!(params = nil)
click to toggle source
# File lib/dash_overlord/models/v1/dynamo_db/migration.rb, line 14 def create!(params = nil) @client.create_table(params || create_params) end
create_params()
click to toggle source
# File lib/dash_overlord/models/v1/dynamo_db/migration.rb, line 18 def create_params # THIS NEEDS TO BE DYNAMIC! { table_name: @migration_class.table_name, key_schema: [ { attribute_name: "dashboard_id", key_type: "HASH" #PRIMARY KEY }, { attribute_name: "id", key_type: "RANGE" # SORT KEY }, ], attribute_definitions: [ { attribute_name: "dashboard_id", attribute_type: "N" }, { attribute_name: "id", attribute_type: "N" } ], provisioned_throughput: { read_capacity_units: 10, write_capacity_units: 10 } } end
delete!()
click to toggle source
# File lib/dash_overlord/models/v1/dynamo_db/migration.rb, line 49 def delete! @client.delete_table(delete_params) end
delete_params()
click to toggle source
# File lib/dash_overlord/models/v1/dynamo_db/migration.rb, line 53 def delete_params { table_name: @migration_class.table_name } end