We are working on the project's migration to EF 6.3.0 from 6.2.0 and we have figured out that the old migration.exe utility was replaced to the ef6.exe.
Our CD contains a few steps related to EF
All of those steps are working correctly with the command:
migration.exe /scriptFile:"***"
we are trying to do the same with the new one:
ef6 database update -a *** --script
But it does not generate the output file only console output.
Do we have any possibilities to generate an output file?
Further technical details
EF version: 6.3.0
ef6.exe file version: 6.300.19.46401
Pipe to a file?
@ErikEJ yes, we want to get a file like "migration.sql", but --script does not support any arguments
@vbondaryuk Are you saying to can't pipe the contents to a file? How is this related to the arguments of --script?
Have you tried? :
ef6 database update -a *** --script > script.sql
Have you tried? :
ef6 database update -a *** --script > script.sql
@ErikEJ yes, I have tried it but > just redirect output to file, moreover output has a batch of redundant information(bellow). I can parse the file and retrieve the required information, but from my perspective, ef6.exe should have the possibilities to specify the output file where to write the SQL script has been generated.
Target database is: ***
Applying explicit migrations: [***]
Applying explicit migration: ***
@vbondaryuk Are you saying to can't pipe the contents to a file? How is this related to the arguments of
--script?
@ajcvickers It was just an example based on the experience of working with the previous version migrate.exe where we can specify the output file via /scriptFile, therefore, I assumed that ef6.exe has the same behavior with --script. From the announcement:
```
Added the ef6.exe utility for enabling, adding, scripting, and applying migrations from assemblies. This replaces migrate.exe
Note from triage: @bricelam to show example of piping to a file.
Use the --prefix-output option. SQL lines will begin with data. Here is an example using PowerShell:
ef6 database update --script --prefix-output -a *** |
where { $_.StartsWith('data:') } |
foreach { $_.Substring(9) } > migration.sql
Triage: at this point we don't plan to make any additional changes here.