Class: Syncoku::LocalDb

Inherits:
Object
  • Object
show all
Includes:
CaptureBackup, Runnable
Defined in:
lib/syncoku/local_db.rb

Instance Method Summary collapse

Methods included from CaptureBackup

#capture, #production_app_name, #run_on_production

Methods included from Runnable

#run_command, #test_command

Instance Method Details

#rebuildObject



20
21
22
23
24
25
26
# File 'lib/syncoku/local_db.rb', line 20

def rebuild
  kill_connections
  puts "Rebuilding database"
  run_command "bundle exec rake db:drop db:create db:migrate"
  puts "Seeding"
  run_command "bundle exec rake db:seed"
end

#syncObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/syncoku/local_db.rb', line 7

def sync
  if File.exist?("#{dump_filename}")
    ask_to_download
  else
    download
  end
  drop_and_create
  pg_restore
  migrate
  run_hook 'after_sync'
  `touch tmp/restart.txt`
end