File tree 3 files changed +16
-2
lines changed
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ assets:remote:sync || assets:push # Synchronize your remote assets using local
76
76
77
77
db:local:sync || db:pull # Synchronize your local database using remote database data
78
78
db:remote:sync || db:push # Synchronize your remote database using local database data
79
+ db:remote:backup || db:backup # Backup the remote database and download it
79
80
```
80
81
81
82
## Example
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ def postgresql_db_valid?(local_db, remote_db)
215
215
( remote_db . nil? || ( remote_db && remote_db . postgresql? ) )
216
216
end
217
217
218
- def remote_to_local ( instance )
218
+ def remote_to_local ( instance , sync = true )
219
219
local_db = Database ::Local . new ( instance )
220
220
remote_db = Database ::Remote . new ( instance )
221
221
@@ -226,7 +226,7 @@ def remote_to_local(instance)
226
226
ensure
227
227
remote_db . clean_dump_if_needed
228
228
end
229
- local_db . load ( remote_db . output_file , instance . fetch ( :db_local_clean ) )
229
+ local_db . load ( remote_db . output_file , instance . fetch ( :db_local_clean ) ) if sync
230
230
end
231
231
232
232
def local_to_remote ( instance )
Original file line number Diff line number Diff line change 31
31
end
32
32
end
33
33
end
34
+
35
+ desc 'Backup the remote database data and download it'
36
+ task :backup do
37
+ on roles ( :db ) do
38
+ if fetch ( :skip_data_sync_confirm ) || Util . prompt ( 'Are you sure you want to erase your local database with server database' )
39
+ puts "Downloading your backup file for remote database..."
40
+ Database . remote_to_local ( self , false )
41
+ end
42
+ end
43
+ end
34
44
end
35
45
36
46
namespace :local do
66
76
end
67
77
end
68
78
79
+ desc 'Backup the remote database and download it'
80
+ task :backup => "db:remote:backup"
81
+
69
82
desc 'Synchronize your local database using remote database data'
70
83
task :pull => "db:local:sync"
71
84
You can’t perform that action at this time.
0 commit comments