[英]Is Entity Framework Core migration can affect SQL Server indexes?
I want to create indexes in my DB SQL Server directly via SSMS for optimization purpose.我想直接通过 SSMS 在我的 DB SQL 服务器中创建索引以进行优化。 I'm using Entity Framework core in my .NET Core web API and using EF Core DB migration.
我在我的 .NET Core web API 中使用实体框架核心并使用 EF Core DB 迁移。 Will EF Core migration will affect or delete the existing indexes?
EF Core 迁移会影响或删除现有索引吗?
This is something relatively easy to do,这是比较容易做到的,
Running a simple Add-Migration MigrationNameHere
from the NPM command line should create you a new migration.从 NPM 命令行运行一个简单的
Add-Migration MigrationNameHere
应该会为您创建一个新的迁移。
From there its simply a case of population the Up()
and Down()
with the index creation and dropping via the migrationBuilder.CreateIndex()
or the migrationBuilder.DropIndex()
methods.从那里它只是通过
migrationBuilder.CreateIndex()
或migrationBuilder.DropIndex()
方法使用索引创建和删除填充Up()
和Down()
的情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.