Class: DatabasePatcher::Action::PatchApplier
Instance Attribute Summary
#interface
Instance Method Summary
collapse
#initialize
Instance Method Details
#down ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/database_patcher/action/patch_applier.rb', line 13
def down
return unless interface.ask('This will execute all the down patches! Are you sure?')
connection = DatabasePatcher::DB.create_connection
connection.transaction do
fetcher = DatabasePatcher::Fetcher.new(connection, interface)
fetcher.get_intalled_patches.each do |installed_patche|
installed_patche.down(connection)
end
end
end
|
#rollback ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/database_patcher/action/patch_applier.rb', line 24
def rollback
return unless interface.ask('This will execute the last patch down part! Are you sure?')
connection = DatabasePatcher::DB.create_connection
connection.transaction do
fetcher = DatabasePatcher::Fetcher.new(connection, interface)
fetcher.get_intalled_patches.each do |patch|
patch.down(connection)
break
end
end
end
|
#up ⇒ Object
3
4
5
6
7
8
9
10
11
|
# File 'lib/database_patcher/action/patch_applier.rb', line 3
def up
connection = DatabasePatcher::DB.create_connection
connection.transaction do
fetcher = DatabasePatcher::Fetcher.new(connection, interface)
fetcher.get_pending_patches.each do |pending_patch|
pending_patch.up(connection)
end
end
end
|