pekspro / EF-Migrations-Script-Generator-Task

24 stars 7 forks source link

Script generated from build task is empty #31

Closed andegre closed 3 years ago

andegre commented 3 years ago

I'm running .NET Core 5.0 and trying to get our DB changes included in our Azure DevOps configuration.

I added in the script, specifying startup project, output location, etc. But the output file that gets generated ONLY contains the insert statement for the EFMigrations table.

Where is the sql for the actual changes to the DB [schema] that need to occur in this build/release process?

Here's the YAML for the script:

- task: efcore-migration-script-generator-task@0 inputs: projectpath: 'src/My.Data.Project/My.Data.Project.csproj' databasecontexts: 'MyDbContext' startupprojectpath: 'src/My.Project.AdminApi/My.Project.AdminApi.csproj' targetfolder: '$(build.artifactstagingdirectory)/migrations' installdependencies: true

pekspro commented 3 years ago

Hmm… that sounds a bit strange. What happens if you run the command locally? You see the exact command that is executed in the logs (it is something with dotnet ef).

andegre commented 3 years ago

Yes, I'm been running the commands locally (dotnet ef migrations add XXX) and (dotnet ef database update) (ignore syntax). It creates my *.cs files that contain the changes, and DOES update the database when the 2nd command is performed.

Is there a way to execute your script directly so I can confirm whether it's my setup/config, or if if it's a bug?

pekspro commented 3 years ago

I think the easiest way is that you add a .NET Core task into your pipeline, and then execute with a custom command. Then you could do everything manually and see if there is any difference.