Skip to content

Commit 8370e8f

Browse files
committed
corrected option for filename
1 parent c089a3d commit 8370e8f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,15 @@ To export a remote database to OVERRIDE your local database by running:
6868
```bash
6969
php artisan db:production-sync
7070
```
71+
72+
Provide a filename for export on the fly by passing the option --filename, remember to provide .sql
73+
74+
```bash
75+
php artisan db:production-sync --filename=other.sql
76+
```
77+
78+
Run the command without attempting to export:
79+
80+
```bash
81+
php artisan db:production-sync --test
82+
```

src/Console/DbSyncCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class DbSyncCommand extends Command
99
{
10-
protected $signature = 'db:production-sync {--test}';
10+
protected $signature = 'db:production-sync {--test} {--filename=}';
1111
protected $description = 'Sync production database with local';
1212

1313
public function handle(): bool
@@ -31,7 +31,7 @@ public function handle(): bool
3131
$ignoreTables = explode(',', $ignore);
3232
$importSqlFile = config('dbsync.importSqlFile');
3333
$removeFileAfterImport = config('dbsync.removeFileAfterImport');
34-
$fileName = $this->argument('filename') ?? config('dbsync.defaultFileName');
34+
$fileName = $this->option('filename') ?? config('dbsync.defaultFileName');
3535

3636
if (empty($host) || empty($username) || empty($database)) {
3737
$this->error("DB credentials not set, have you published the config and set ENV variables?");

0 commit comments

Comments
 (0)