如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

这篇文章主要介绍“如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步”,在日常操作中,相信很多人在如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

1.添加字段信息

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

add-migration AddbeizhuForMobanleixing

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

2.迁移记录

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

3.更新数据库

Update-Database

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

4.移除迁移记录 remove-migration 提示:已经在数据库中了,这个时候需要回滚数据

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

5.回滚数据

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步 复制回滚名称

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

键入代码命令: update-database AlterMobanleixingSeedData

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

然后在移除迁移记录: remove-migration

如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步

到此,关于“如何使用Asp.net core3.0 web api Migrations迁移功能使数据库同步”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!