Reputation: 39220
I'd like to roll back my database to the total pre-state, i.e. invoke every Down()
method in all the migrations, including the initial one.
Checking this blog, there's no hints on that, despite it being rather comprehensive. There's been a way as shown here (in short: Update-Database –TargetMigration: $InitialDatabase) but it doesn't work in Core, regrettably.
My workaround at the moment is to go drop database
but I feel it'd be letting the computer win and I want to show it who's the boss. (It's me.)
Other than that, it seems that google fails me this time. How do I do that?
Upvotes: 3
Views: 1314
Reputation: 205769
You are looking at EF6 documentation. EF Core documentation for PMC is Update-Database with optional parameter -Migration <String>
with the following semantics
The target migration. Migrations may be identified by name or by ID. The number 0 is a special case that means before the first migration and causes all migrations to be reverted. If no migration is specified, the command defaults to the last migration.
and example
The following example reverts all migrations.
Update-Database -Migration 0
Shortly, passing the special value 0
does what you are asking for.
.NET Core CLI command is dotnet ef database update with optional parameter for migration name with the same semantics, e.g.
dotnet ef database update 0
Upvotes: 7