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

Verify No Changes Command #30457

Closed
justindbaur opened this issue Mar 11, 2023 · 2 comments
Closed

Verify No Changes Command #30457

justindbaur opened this issue Mar 11, 2023 · 2 comments

Comments

@justindbaur
Copy link
Contributor

justindbaur commented Mar 11, 2023

Problem:
I need to be able to create a CI job that can verify that there have been no changes to our database schema without a migration being added for it. So that I can create a PR gate.

Solution:
I would love a command in the dotnet ef CLI to verify no migrations are needed, something like.

dotnet ef migrations verify-no-changes

This would respond with exit code 0 if no migrations are needed and exit code 1 if migrations are needed.

I believe it would essentially just need to gather up operations like here:

var upOperations = Dependencies.MigrationsModelDiffer
.GetDifferences(lastModel, Dependencies.Model.GetRelationalModel());

Then it would just check that both lists are empty. I would be more than willing to work on this if the idea is approved.

Alternate Solution:
Add an additional options to dotnet ef migrations add for --ensure-empty so that it will fail when there are operations that are needed and will return with a non-zero exit code.

@ajcvickers
Copy link
Contributor

Duplicate of #26348. Please make sure to vote (👍) for that issue.

@justindbaur
Copy link
Contributor Author

@ajcvickers Thank you! I tried to find one but my google-fu isn't good enough I guess.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
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

2 participants