故如虹,知恩;故如月,知明
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术

ef数据库迁移命令

4073人阅读 2019/12/23 9:52 总访问:3838082 评论:0 收藏:0 手机
分类: .NET Core

.net core 数据库迁移可以参考:https://www.tnblog.net/aojiancc2/article/details/5370



可以使用get-help命令查看命令的详情


get-help Add-Migration -detailed

get-help Update-Database -detailed


Add-Migration

语法

    Add-Migration [-Name] <String> [-OutputDir <String>] [-Context <String>] [-Project <String>] [-StartupProject <String>] [<CommonParameters>]

       

说明

    Adds a new migration.

    

参数

    -Name <String>

        The name of the migration.

        

    -OutputDir <String>

        The directory (and sub-namespace) to use. Paths are relative to the project directory. Defaults to "Migrations".

        

    -Context <String>

        The DbContext type to use.

        

    -Project <String>

        The project to use.

        

    -StartupProject <String>

        The startup project to use. Defaults to the solution's startup project.

        

    <CommonParameters>

        此 Cmdlet 支持通用参数: Verbose、Debug、

        ErrorAction、ErrorVariable、WarningAction、WarningVariable、

        OutBuffer 和 OutVariable。有关详细信息,请参阅

        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216)。 

    

备注

    若要查看示例,请键入: "get-help Add-Migration -examples".

    有关详细信息,请键入: "get-help Add-Migration -detailed".

    若要获取技术信息,请键入: "get-help Add-Migration -full".

    有关在线帮助,请键入: "get-help Add-Migration -online"


摘要

    Updates the database to a specified migration.

    

    

语法

    Update-Database [[-Migration] <String>] [-Context <String>] [-Project <String>] [-StartupProject <String>] [<CommonParameters>]

    


Update-Database

说明

    Updates the database to a specified migration.

    

参数

    -Migration <String>

        The target migration. If '0', all migrations will be reverted. Defaults to the last migration.

        

    -Context <String>

        The DbContext to use.

        

    -Project <String>

        The project to use.

        

    -StartupProject <String>

        The startup project to use. Defaults to the solution's startup project.

        

    <CommonParameters>

        此 Cmdlet 支持通用参数: Verbose、Debug、

        ErrorAction、ErrorVariable、WarningAction、WarningVariable、

        OutBuffer 和 OutVariable。有关详细信息,请参阅

        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216)。 

    

备注

    若要查看示例,请键入: "get-help Update-Database -examples".

    有关详细信息,请键入: "get-help Update-Database -detailed".

    若要获取技术信息,请键入: "get-help Update-Database -full".

    有关在线帮助,请键入: "get-help Update-Database -online"


欢迎加群讨论技术,群:677373950(满了,可以加,但通过不了),2群:656732739

评价