Skip to content

How to do a missing migration check in CI #26348

@maxkoshevoi

Description

@maxkoshevoi

Ask a question

I have an idea to add "missing migration" check to my CI pipeline. This check should validate that DbSnapshot that is present in a branch matches models in that branch (in another words, it should validate that if I will create a migration, Up and Down would be empty).

Straightforward way of doing this would be to execute dotnet ef migrations add Test and validate that resulting files match "empty migration" ones, but this seems like a hack.

Is there an easier way of doing this? Like dotnet ef migrations --verify-snapshot-up-to-date or something?

Include provider and version information

EF Core version:
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Linux (for CI pipeline)
IDE: Visual Studio 2022

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions