Class: DBRotator

Inherits:
Object
  • Object
show all
Defined in:
lib/db_rotator.rb

Defined Under Namespace

Classes: Schema

Constant Summary collapse

TIME_FORMAT =
"%Y%m%d"

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ DBRotator

Returns a new instance of DBRotator.



6
7
8
9
10
11
12
13
# File 'lib/db_rotator.rb', line 6

def initialize(config)
  @config = config.config
  @schemas = []

  populate_schemas
rescue
  on_failure $!
end

Instance Method Details

#importObject



31
32
33
34
# File 'lib/db_rotator.rb', line 31

def import
  import_dump
  populate_schemas
end

#refreshObject



24
25
26
27
28
29
# File 'lib/db_rotator.rb', line 24

def refresh
  download_dump
  import
  prune
  grant_access
end

#rotateObject



15
16
17
18
19
20
21
22
# File 'lib/db_rotator.rb', line 15

def rotate
  refresh
  update_db_yaml
  on_success

rescue
  on_failure $!
end