Class: Breeze::Db

Inherits:
Veur
  • Object
show all
Defined in:
lib/breeze/tasks/db.rb

Instance Method Summary collapse

Methods inherited from Veur

inherited

Instance Method Details

#clone(old_db, new_db) ⇒ Object



26
27
28
# File 'lib/breeze/tasks/db.rb', line 26

def clone(old_db, new_db)
  rds.restore_db_instance_to_point_in_time(old_db, new_db, 'UseLatestRestorableTime' => true)
end

#create(name, db_name = nil) ⇒ Object



7
8
9
10
11
# File 'lib/breeze/tasks/db.rb', line 7

def create(name, db_name=nil)
  options.update(:id => name, :db_name => db_name)
  # puts "DB options: #{options}"
  rds.servers.create(options)
end

#destroy(name) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/breeze/tasks/db.rb', line 15

def destroy(name)
  db = rds.servers.get(name)
  if not %w(available failed storage-full incompatible-parameters incompatible-restore).include?(db.state)
    puts "ERROR: cannot destroy db while state is #{db.state}!"
  elsif force_or_accept?("Destroy DB #{name}?")
    db.destroy(nil)
    db.reload
  end
end