dotnet/efcore

EF Bundle should also generate rollback app

Closed this issue · 1 comments

Now we can do:

 dotnet ef migrations bundle ----configuration Bundle -r linux-x64  --self-contained

It creates an app that runs the migrations, we deploy that as a separate step in the pipeline.

It would be great to also have an option to generate an that has a target migration:

 dotnet ef migrations bundle ----configuration Bundle -r linux-x64  --self-contained --target-migration MyPreviousMigration

Once we have that, we could add one more option, that would automatically get the latets migration from an existing db:

 dotnet ef migrations bundle ----configuration Bundle -r linux-x64  --self-contained --rollback-to ($MY_CONNECTION_STRING)
  • this would create efbundle-rollback with target migration being the latest on applied in the database

That way we could add an optional step to the pipeline, that would rollback all migrations that happened in given release. Right now if we rollback the code, we also have to generate the migration script by hand and run it manually, which is error prone and slow.

You can already do that with the bundle by specifying the target migration when running it