Skip to content

Add 'Drop-Database' - #6300

Merged
natemcmaster merged 2 commits into
dotnet:feature/ef.exefrom
natemcmaster:drop-database
Aug 12, 2016
Merged

natemcmaster merged 2 commits into
dotnet:feature/ef.exefrom
natemcmaster:drop-database

Conversation

@natemcmaster

Copy link
Copy Markdown
Contributor

Close #2476

cc @bricelam

about_EntityFrameworkCore
#>
function Drop-Database {
[CmdletBinding(PositionalBinding = $false)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SupportsShouldProcess = $true

This is the idiomatic way of doing confirmation and dry runs in PowerShell

@natemcmaster
natemcmaster force-pushed the drop-database branch 2 times, most recently from 282c206 to 3955c6a Compare August 11, 2016 22:30
@natemcmaster

Copy link
Copy Markdown
Contributor Author

Updated to be idiomatic. Here is what the different options look like.

image

@rhires

rhires commented Aug 12, 2016

Copy link
Copy Markdown

Should the default to drop a database be [Y]?

@natemcmaster

Copy link
Copy Markdown
Contributor Author

I understand the concern, but IMO it's safe to assume that users intend to drop the database if they typed the command 'Drop-Database'.


if (!($info)) {
Write-Output 'Could not find a database to remove'
} elseif ($Force -or

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using -Force for this in PowerShell is an anti-pattern. Instead, the user would either set $ConfirmPreference or use the -Confirm:$false default parameter.

@natemcmaster

natemcmaster commented Aug 12, 2016 •

Copy link
Copy Markdown
Contributor Author

Updated. Here's take 3.

image

@bricelam

Copy link
Copy Markdown
Contributor

:shipit:

@natemcmaster
natemcmaster merged commit 66f9b58 into dotnet:feature/ef.exe Aug 12, 2016
@natemcmaster
natemcmaster deleted the drop-database branch August 12, 2016 21:34
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.

4 participants