Skip to content

Commit 9a35d3b

Browse files
authored
Merge pull request #13 from xfolder/main
add --skip-tz-utc option to mysqldump
2 parents 9884c18 + 347b4fe commit 9a35d3b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ To specify a different local database connection:
6868
LOCAL_TARGET_CONNECTION=different_mysql_connection
6969
```
7070

71+
For only mysqldump:
72+
```
73+
REMOTE_MYSQLDUMP_SKIP_TZ_UTC=true
74+
```
75+
7176
## Usage
7277

7378
To export a remote database to OVERRIDE your local database by running:

config/dbsync.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@
6666
* Sets the target databse connection
6767
*/
6868
'targetConnection' => env('LOCAL_TARGET_CONNECTION', 'mysql'),
69+
70+
'mysqldumpSkipTzUtc' => env('REMOTE_MYSQLDUMP_SKIP_TZ_UTC', false),
6971
];

src/Console/DbSyncCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function handle(): bool
3434
$importSqlFile = config('dbsync.importSqlFile');
3535
$removeFileAfterImport = config('dbsync.removeFileAfterImport');
3636
$fileName = $this->option('filename') ?? config('dbsync.defaultFileName');
37+
$mysqldumpSkipTzUtc = config('dbsync.mysqldumpSkipTzUtc') ? '--skip-tz-utc' : '';
3738

3839
$targetConnection = config('dbsync.targetConnection');
3940

@@ -53,7 +54,7 @@ public function handle(): bool
5354
if ($useSsh === true) {
5455
exec("ssh $sshUsername@$host -p$sshPort mysqldump -P$port -u$username -p$password $database $ignoreString > $fileName", $output);
5556
} else {
56-
exec("mysqldump -h$host -P$port -u$username -p$password $database $ignoreString --column-statistics=0 > $fileName", $output);
57+
exec("mysqldump -h$host -P$port -u$username -p$password $database $ignoreString $mysqldumpSkipTzUtc --column-statistics=0 > $fileName", $output);
5758
}
5859

5960
$this->comment(implode(PHP_EOL, $output));

0 commit comments

Comments
 (0)