Search code examples
entity-frameworkef-code-first

How to get SQL Script using Entity Framework Core(code first)


I'm create a web app using Asp.net core with EntityFramework core, but the Update-Database command no longer has the "-Script" switch. How can I get the sql script? Thanks.


Solution

  • Run this command to produce the SQL Script

    > dotnet ef migrations script -o fileName.sql
    

    Also there's a powershell command for it too: powershell#script-migration