File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ def initialize(cap_instance)
112112
113113 def dump
114114 @cap . execute "cd #{ @cap . current_path } && #{ dump_cmd } | #{ compressor . compress ( '-' , output_file ) } "
115+ @cap . execute ( "ln -fs #{ @cap . current_path } /#{ output_file } #{ @cap . current_path } /db/latest.sql.#{ compressor . file_extension } " )
115116 self
116117 end
117118
@@ -212,6 +213,11 @@ def backup(instance)
212213 remote_db = Database ::Remote . new ( instance )
213214 remote_db . dump
214215 end
216+
217+ def restore_latest ( instance )
218+ remote_db = Database ::Remote . new ( instance )
219+ remote_db . load ( "#{ instance . current_path } /db/latest.sql.#{ remote_db . compressor . file_extension } " , false )
220+ end
215221 end
216222
217223end
Original file line number Diff line number Diff line change 3737 Database . backup ( self )
3838 end
3939 end
40+
41+ desc 'Restores the latest database dump from the remote folder (pairs with db:remote:backup)'
42+ task :restore_latest do
43+ on roles ( :db ) do
44+ Database . restore_latest ( self )
45+ end
46+ end
4047 end
4148
4249 namespace :local do
You can’t perform that action at this time.
0 commit comments