Files
chill_notes/dotNet知识库/EF CORE/EF Core Migration.md
2026-04-16 00:28:41 +08:00

12 lines
1.2 KiB
Markdown
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**EF Core Migration**
 **手动命令行的方式**
Update-Database -Verbose -c safeMonitorDbContext
| | | |
| ------------------------------------------- | --------------------------------- | ------------------------------- |
| VSCode | VS2017 | 说明 |
| dotnet ef migrations add InitialCreate | Add-Migration | 对当前EF实体模型增加一个配置文件 |
| dotnet ef database update | Update-Database | 对当前版本进行更新 |
| dotnet ef migrations remove | Remove-Migration | 删除最新的Migration |
| dotnet ef database update LastGoodMigration | Update-Database LastGoodMigration | 对指定版本进行更新 |
| dotnet ef migrations script | Script-Migration | 对当前更新生成一个sql的脚本我们可以使用脚本到数据库取执行 |