Get SQL file for specific migration in Entity Framework 6 C#

ef-code-first entity-framework entity-framework-6

Accepted Answer

Yes, you might do so by using the following migration-SQL:

Update-Database -Script -SourceMigration: <pointFromWichYouWantToStartWithGeneration> -TargetMigration: <pointWhereToEndWithGeneration>

Execute the following commands to construct a script for all migrations:

Update-Database -Script -SourceMigration: $InitialDatabase

It will create a SQL script file in instead of updating the database. Therefore, even if the migration has already been implemented on the database, you could still build a SQL script.

Here, at The SQL Script for Entity Framework Code First Migrations, you may get additional details about it.

Run the Update-Database command but this time specify the –Script flag so that changes are written to a script rather than applied. We’ll also specify a source and target migration to generate the script for.

19
2/12/2020 8:34:00 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow