網站首頁 編程語言 正文
命令列表
Cmdlet Description -------------------------- --------------------------------------------------- Add-Migration Adds a new migration. Drop-Database Drops the database. Get-DbContext Gets information about a DbContext type. Remove-Migration Removes the last migration. Scaffold-DbContext Scaffolds a DbContext and entity types for a database. Script-DbContext Generates a SQL script from the current DbContext. Script-Migration Generates a SQL script from migrations. Update-Database Updates the database to a specified migration.
Add-Migration
說明: 添加新的遷移。
以下示例創建一個指定名稱A的遷移
- Add-Migration A
Drop-Database
說明: 刪除數據庫。
以下示例刪除數據庫
- Drop-Database -WhatIf
Get-DataContext
說明: 獲取數據庫上下文得相關信息
Remove-Migration
說明: 刪除上次遷移(回滾為遷移完成的代碼更改)
以下示例強制刪除上一次遷移
- Remove-Migration -Force
Scaffold-DbContext
說明: 為數據庫和實體類型生成代碼。為了生成實體類型,數據庫表必須具有主鍵。DbContextScaffold-DbContext
Script-Migration
說明: 生成 SQL 腳本,該腳本將從一個選定遷移到另一個選定遷移的所有更改應用。
下面的示例使用遷移名稱為初始創建遷移創建腳本。
- Script-Migration -To InitialCreate
下面的示例使用遷移 ID 為初始創建遷移后的所有遷移創建腳本。
- Script-Migration -From 20180904195021_InitialCreate
Update-Database
說明: 將數據庫更新為上次遷移或指定的遷移。
下面示例為還原所有遷移
- Update-Database -Migration 0
以下示例將數據庫更新為指定的遷移。第一個使用遷移名稱,第二個使用遷移 ID 和指定的連接: - Update-Database -Migration InitialCreate
- Update-Database -Migration 20180904195021_InitialCreate -Connection your_connection_string
原文鏈接:https://www.cnblogs.com/zh7791/p/12931449.html
相關推薦
- 2022-10-22 Kotlin基礎通關之字符串與數字類型_Android
- 2022-03-16 Android跟隨手指移動的控件demo實例_Android
- 2022-05-11 SpringBoot jackson返回值中含有null的解決辦法
- 2022-09-13 Go語言對前端領域的入侵WebAssembly運行原理_Golang
- 2022-11-27 C語言三種函數調用約定_cdecl與_stdcall及_fastcall詳細講解_C 語言
- 2022-04-19 C語言位段(位域)機制結構體的特殊實現及解析_C 語言
- 2022-07-18 Android 解決InputMethodManager 內存泄露問題
- 2021-12-02 如何解決用ESLint驗證導致報錯的問題
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支