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

Tools: Add -WhatIf parameter to Update-Database #1775

Open
Tracked by #22946
bricelam opened this issue Mar 6, 2015 · 8 comments
Open
Tracked by #22946

Tools: Add -WhatIf parameter to Update-Database #1775

bricelam opened this issue Mar 6, 2015 · 8 comments

Comments

@bricelam
Copy link
Contributor

bricelam commented Mar 6, 2015

This would show the migrations that would be applied to the database.

This functionality is also related to #577.

@rowanmiller rowanmiller added this to the Backlog milestone Mar 9, 2015
@glen-84
Copy link

glen-84 commented May 22, 2015

Maybe --dry-run ? (see here)

@bricelam
Copy link
Contributor Author

-WhatIf is a first-class concept in PowerShell. We could consider using --dry-run in the DNX (and Console) commands, but I think there is more value in using a common language between the different interfaces.

@glen-84
Copy link

glen-84 commented May 22, 2015

Ah, okay, I didn't know about that. It's a bit of an odd name. 😄

I think the DNX commands use lower or possibly camelCase, so I guess it'll be --whatif, --what-if, or --whatIf.

@bricelam bricelam added the tools label Jan 13, 2017
@bricelam bricelam removed the tools label Apr 26, 2017
@bricelam bricelam changed the title Commands: Add -WhatIf parameter to Apply-Migration Tools: Add -WhatIf parameter to Apply-Migration Apr 19, 2018
@matt-goldman
Copy link

+1 this would be so useful. Also agree with using the -WhatIf (even if in lowercase) as its familiar from PowerShell.

@bricelam bricelam changed the title Tools: Add -WhatIf parameter to Apply-Migration Tools: Add -WhatIf parameter to Update-Database May 5, 2021
@stap123
Copy link

stap123 commented Oct 14, 2022

bicep also uses what-if as the syntax for this

@aunikitin
Copy link

Hello, any updates?

@bricelam
Copy link
Contributor Author

bricelam commented Sep 29, 2023

No updates. Today you can use Get-Migration to see which migrations are pending and Script-Migration to see the SQL they'll generate.

@EliveltonRepolho
Copy link

This is still not helpfull using the Script-Migration to see the SQL, because it don't show the script for only not applyied migration, it shows the script starting from a migration I have to provide, so on large teams where we frequently deploy and you have a scenario where you have some migrations that are applied and some there are not mixed, you have the create a program to see all peding script.

Would be very helpfull to see a --dry-run option, since EF already does it internally to apply only the pending.

My example is something like this:

1231(Timestamp)_Migration1.cs -- Applied
1232(Timestamp)_Migration2.cs -- NOT Applied
1233(Timestamp)_Migration3.cs -- Applied
1234(Timestamp)_Migration4.cs -- NOT Applied
1235(Timestamp)_Migration5.cs -- Applied

I want to see only the "NOT Applied" scripts, I need to run 2 scripts in this case, but as it grows this become less efficient

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

No branches or pull requests

8 participants