From 1197b9eceac2f2b835db99fe88ae98bfb7d0acc0 Mon Sep 17 00:00:00 2001 From: Kevin Matsubara Date: Mon, 7 Apr 2025 10:13:55 +0200 Subject: [PATCH] Update README with rollback and list commands. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 1b0ab0b..6caccff 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ Create a migration, inside of the Console project, referring to the Data project `dotnet ef migrations add InitialMigration --startup-project ./ --project ../EntityFrameworkCore.Data` +Show migration status (`Get-Migration` has more details): + +`dotnet ef migrations list --startup-project ./ --project ../EntityFrameworkCore.Data` + Update the database: `dotnet ef database update --startup-project ./ --project ../EntityFrameworkCore.Data` @@ -51,6 +55,12 @@ Create migration script (This generates SQL of all the migrations). Add the `--i `dotnet ef migrations script --startup-project ./ --project ../EntityFrameworkCore.Data` +Rollback to specific migration, use `list` command to see (Pending) changes: + +`dotnet ef database update 20250406180432_AddMatchAndLeagueEntities --startup-project ./ --project ../EntityFrameworkCore.Data` + +To re-apply changes again, simply do a `database update` again. Beware that data will be lost. + ## Links * [Entity Framework - Database providers](https://learn.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli)