Class: DatabasePatcher::PatchApplier

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

Instance Method Summary collapse

Instance Method Details

#downObject



13
14
15
16
17
18
19
20
21
# File 'lib/database_patcher/patch_applier.rb', line 13

def down
  connection = DatabasePatcher::DB.create_connection
  connection.transaction do
    fetcher = DatabasePatcher::Fetcher.new(connection)
    fetcher.get_intalled_patches.each do |installed_patche|
      installed_patche.down(connection)
    end
  end
end

#rollbackObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/database_patcher/patch_applier.rb', line 23

def rollback
  connection = DatabasePatcher::DB.create_connection
  connection.transaction do
    fetcher = DatabasePatcher::Fetcher.new(connection)
    fetcher.get_intalled_patches.each do |patch|
      patch.down(connection)
      break
    end
  end
end

#upObject



3
4
5
6
7
8
9
10
11
# File 'lib/database_patcher/patch_applier.rb', line 3

def up
  connection = DatabasePatcher::DB.create_connection
  connection.transaction do
    fetcher = DatabasePatcher::Fetcher.new(connection)
    fetcher.get_pending_patches.each do |pending_patch|
      pending_patch.up(connection)
    end
  end
end