File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ public function handle(): bool
31
31
$ ignoreTables = explode (', ' , $ ignore );
32
32
$ importSqlFile = config ('dbsync.importSqlFile ' );
33
33
$ removeFileAfterImport = config ('dbsync.removeFileAfterImport ' );
34
+ $ fileName = $ this ->argument ('filename ' ) ?? config ('dbsync.defaultFileName ' );
34
35
35
36
if (empty ($ host ) || empty ($ username ) || empty ($ database )) {
36
37
$ this ->error ("DB credentials not set, have you published the config and set ENV variables? " );
@@ -45,19 +46,19 @@ public function handle(): bool
45
46
}
46
47
47
48
if ($ useSsh === true ) {
48
- exec ("ssh $ sshUsername@ $ host -p $ sshPort mysqldump -u $ username -p $ password $ database $ ignoreString > file.sql " , $ output );
49
+ exec ("ssh $ sshUsername@ $ host -p $ sshPort mysqldump -u $ username -p $ password $ database $ ignoreString > $ fileName " , $ output );
49
50
} else {
50
- exec ("mysqldump -h $ host -u $ username -p $ password $ database $ ignoreString --column-statistics=0 > file.sql " , $ output );
51
+ exec ("mysqldump -h $ host -u $ username -p $ password $ database $ ignoreString --column-statistics=0 > $ fileName " , $ output );
51
52
}
52
53
53
54
$ this ->comment (implode (PHP_EOL , $ output ));
54
55
55
56
if ($ importSqlFile === true ) {
56
- DB ::unprepared (file_get_contents (base_path (' file.sql ' )));
57
+ DB ::unprepared (file_get_contents (base_path ($ fileName )));
57
58
}
58
59
59
60
if ($ removeFileAfterImport === true ) {
60
- unlink (' file.sql ' );
61
+ unlink ($ fileName );
61
62
}
62
63
}
63
64
You can’t perform that action at this time.
0 commit comments