简体   繁体   English

EF Core ASP.Net Core 编辑迁移

[英]EF Core ASP.Net Core edit migration

If I need to change the database migration, should I add it to the existing migration in the column table or do I need to change the data in the designer?如果我需要更改数据库迁移,我应该将它添加到列表中的现有迁移中还是需要在设计器中更改数据? It is important to save the data and keep the startup migration ready.保存数据并保持启动迁移准备就绪非常重要。

在此处输入图像描述

In practice i recomment you not touch the migration,instead run the command Remove-Migration , edit the Configuration of the entities and run the command Add-Migration <migration-name> .在实践中,我建议您不要触摸迁移,而是运行命令Remove-Migration ,编辑实体的配置并运行命令Add-Migration <migration-name>

Or if the app is in development phase simpply use the following steps:或者,如果应用程序处于开发阶段,只需使用以下步骤:

1-remove the folder migration 1-删除文件夹迁移

2-in the nuggets terminal run Drop-Database command 2-在 nuggets 终端运行Drop-Database命令

3-run Add-Migration <migration-name> 3 次运行Add-Migration <migration-name>

4-run Update-Database 4-运行Update-Database

Then you will recreate the database with the modifications.然后您将使用修改重新创建数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM