Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepend the connection onto the name #148

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

michaeljhopkins
Copy link

If you don't pass a name, but DO pass a connection, this will prepend the connection onto the name. Example output below

image

Add some code to add the connection to the snapshot name if it's passed in
@freekmurze
Copy link
Member

Could you add a tests to prove that this works and also update the readme?

@@ -21,7 +21,11 @@ public function handle()
?: config('db-snapshots.default_connection')
?? config('database.default');

$snapshotName = $this->argument('name') ?? Carbon::now()->format('Y-m-d_H-i-s');
if (! is_null($this->option('connection')) && is_null($this->argument('name'))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you refactor this to avoid using. else. Maybe put this logic in a dedicated function with early returns.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted to a private method

@michaeljhopkins
Copy link
Author

@freekmurze test added, connection name extracted to a method, readme updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants