# Net Core Migration 版本異動(降板、新增) ###### tags: `Migration` ``` # 1: 回退到完全沒有遷移的狀態(資料庫將被清空) dotnet ef database update 0 # 2: 添加新的遷移(替換 <MigrationName> 為遷移名稱) # 此步驟會生成新的遷移檔案,例如,用於重建架構或添加變更。 dotnet ef migrations add <MigrationName> # 3: 更新資料庫到新的遷移狀態(應用剛剛添加的遷移) dotnet ef database update <MigrationName> # 4: 移除上一個步驟中添加的遷移檔案(如果不需要保留此遷移) # 此步驟僅移除遷移檔案,不會影響資料庫狀態。 dotnet ef migrations remove dotnet ef database update 20251121065342_RFC_10480_CMDB_Add_Performance_Indexes ``` dotnet ef migrations add RFC_10704_CMDB_Portal_Server_Missing_Function_Enhancement