Skip to content

Commit

Permalink
corrected option for filename
Browse files Browse the repository at this point in the history
  • Loading branch information
dcblogdev committed Jul 8, 2022
1 parent c089a3d commit 8370e8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@ To export a remote database to OVERRIDE your local database by running:
```bash
php artisan db:production-sync
```

Provide a filename for export on the fly by passing the option --filename, remember to provide .sql

```bash
php artisan db:production-sync --filename=other.sql
```

Run the command without attempting to export:

```bash
php artisan db:production-sync --test
```
4 changes: 2 additions & 2 deletions src/Console/DbSyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

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

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

0 comments on commit 8370e8f

Please sign in to comment.