Class: Dynomite::Migration

Inherits:
Object
  • Object
show all
Includes:
Client, Item::WaiterMethods, Helpers
Defined in:
lib/dynomite/migration.rb,
lib/dynomite/migration/dsl.rb,
lib/dynomite/migration/runner.rb,
lib/dynomite/migration/helpers.rb,
lib/dynomite/migration/file_info.rb,
lib/dynomite/migration/generator.rb

Direct Known Subclasses

CreateSchemaMigrations

Defined Under Namespace

Modules: Helpers Classes: Dsl, FileInfo, Generator, Runner

Instance Method Summary collapse

Methods included from Helpers

#table_name_with_namespace

Methods included from Item::WaiterMethods

#waiter

Instance Method Details

#add_gsi(table_name, *args) ⇒ Object



23
24
25
26
27
# File 'lib/dynomite/migration.rb', line 23

def add_gsi(table_name, *args)
  update_table(table_name) do |t|
    t.add_gsi(*args)
  end
end

#create_table(table_name, &block) ⇒ Object



11
12
13
# File 'lib/dynomite/migration.rb', line 11

def create_table(table_name, &block)
  execute(table_name, :create_table, &block)
end

#delete_table(table_name, &block) ⇒ Object



19
20
21
# File 'lib/dynomite/migration.rb', line 19

def delete_table(table_name, &block)
  execute(table_name, :delete_table, &block)
end

#remove_gsi(table_name, *args) ⇒ Object



29
30
31
32
33
# File 'lib/dynomite/migration.rb', line 29

def remove_gsi(table_name, *args)
  update_table(table_name) do |t|
    t.remove_gsi(*args)
  end
end

#upObject



7
8
9
# File 'lib/dynomite/migration.rb', line 7

def up
  puts "Should defined an up method for your migration: #{self.class.name}"
end

#update_gsi(table_name, *args) ⇒ Object



35
36
37
38
39
# File 'lib/dynomite/migration.rb', line 35

def update_gsi(table_name, *args)
  update_table(table_name) do |t|
    t.update_gsi(*args)
  end
end

#update_table(table_name, &block) ⇒ Object



15
16
17
# File 'lib/dynomite/migration.rb', line 15

def update_table(table_name, &block)
  execute(table_name, :update_table, &block)
end

#update_time_to_live(table_name, time_to_live_specification = {}) ⇒ Object Also known as: update_ttl



41
42
43
44
45
46
47
48
# File 'lib/dynomite/migration.rb', line 41

def update_time_to_live(table_name, time_to_live_specification={})
  table_name = table_name_with_namespace(table_name)
  client.update_time_to_live(
    table_name: table_name,
    time_to_live_specification: time_to_live_specification
  )
  # fast enough of an operation, no need to wait
end