EFCore & Mysql migration on Production

最好的办法是通过脚本进行生产环境数据库更新.

如:

dotnet ef migration script -i -o "script.sql". 这样将会产生一个你不用在意线上版本的脚本. 但是Polemo.EntityFrameworkCore.Mysql下暂时是不支持的. 可能将来会支持.

可以通过 dotnet ef migrations <from> <to> -o "script.sql" 来产生脚本.

<from>: 你将进行更新的启始文件.

<to>: 你将进行更新的结束文件.

例如:

产生脚本例如:

run it on production database. and you can get the migrations.

原文地址:https://www.cnblogs.com/VirtualMJ/p/9882114.html