我试图使用数据库迁移来为数据库创建初始表结构和一些种子数据。因此,我创建了两个迁移:InitialCreate和InitialSeed。到目前为止,ModelSnapshot.cs已填充,并且正在生成migration.cs文件。但是现在,当我添加另一个迁移时,我无法再将其删除。例如:我更改了一个次要表并命名为>
add-migration test
我现在拥有文件321321321_test.cs和321321321_test.Designer.cs-到目前为止一切顺利。但是当我打电话
remove-migration
然后不再删除这些文件。没有错误消息,只是不删除任何内容。这是程序包管理器控制台输出:
PM> remove-migration Build started... Build succeeded. Microsoft.EntityFrameworkCore.Model.Validation[30000] No type was specified for the decimal column 'Totalprice' on entity type 'BillSelectEntity'. This will cause values to be silently truncated if they do not fit in the default precision and scale. Explicitly specify the SQL server column type that can accommodate all the values using 'HasColumnType()'. Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 3.1.0 initialized 'OphiContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None Reverting model snapshot. Done.
您知道为什么会发生这种情况吗?是否有地方可以查看框架本身并查看“删除迁移”的实际作用,以便尝试查找问题?欢迎任何提示。
我试图使用数据库迁移来为数据库创建初始表结构和一些种子数据。因此,我创建了两个迁移:InitialCreate和InitialSeed。到目前为止,...
您有1层应用程序还是N层应用程序?您是否尝试指定context
?您是否尝试指定EF所在的startup project
和/或project
?