Skip to content

Commit 9e535fa

Browse files
Update Create.php
Add some code to add the connection to the snapshot name if it's passed in
1 parent a12430e commit 9e535fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Commands/Create.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ public function handle()
2121
?: config('db-snapshots.default_connection')
2222
?? config('database.default');
2323

24-
$snapshotName = $this->argument('name') ?? Carbon::now()->format('Y-m-d_H-i-s');
24+
if (! is_null($this->option('connection')) && is_null($this->argument('name'))) {
25+
$snapshotName = $this->option('connection') . "_" . Carbon::now()->format('Y-m-d_H-i-s');
26+
} else {
27+
$snapshotName = $this->argument('name') ?? Carbon::now()->format('Y-m-d_H-i-s');
28+
}
2529

2630
$compress = $this->option('compress') || config('db-snapshots.compress', false);
2731

0 commit comments

Comments
 (0)