1

표준 .NET 버전의 엔터티 프레임 워크에서 undo을 사용하여 마지막 데이터베이스 업데이트를 수행 할 수 있습니다. 당신이 .NET 코어에 대한 엔티티 프레임 워크 (EntityFrameworkCore)에서이 작업을 시도 할 경우.NET Framework에서 Entity Framework 업데이트 데이터베이스를 실행 취소하는 방법

Update-Database -TargetMigration "NameOfPreviousMigration" 

, 당신은 다음과 같은 오류가 발생합니다 :

Update-Database : A parameter cannot be found that matches parameter name 'TargetMigration'. At line:1 char:17 + Update-database -TargetMigration "NameOfPreviousMigration" + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Update-Database], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Update-Database

가 어떻게 .NET 코어에서 데이터베이스를 되돌릴 수 있습니다?

답변

7

EntityFrameworkCore에서이 작업을 수행하려면 TargetMigration 매개 변수를 사용하지 마십시오. 되돌리려는 마이그레이션의 이름을 지정하기 만하면됩니다.

Update-Database NameOfPreviousMigration 
관련 문제