ef Migration 的一些基础命令

  • cmd ci 命令
    dotnet ef migrations add NewColum --新增migrations
    dotnet ef database update--跟新数据库
    dotnet ef migrations add Addrs--新增一个migrations
    dotnet ef database update
    dotnet ef datebase update NewColum--根据newcolum跟新数据库
    dotnet ef migrations remove--删除最新未使用的migrations
  • VS 程序包管理控制台命令
    Add-Migration InitConfigurations -Context ConfigurationDbContext -OutputDir DataMigrationsIdentityServerConfiguration
    
    Add-Migration InitPersistedGrant -Context PersistedGrantDbContext -OutputDir DataMigrationsIdentityServerPersistedGrantDb
    
    DBcontext 在 Identityserver4.EntityFramwork.DbContexts 命名空间下
    
    Update-Database -Context ConfigurationDbContext 
    
    Update-Database -Context PersistedGrantDbContext
原文地址:https://www.cnblogs.com/chongyao/p/9449791.html