johanclasson / vso-agent-tasks

Build and Release Tasks for Visual Studio Online and Team Foundation Server
MIT License
20 stars 16 forks source link

DbUpMigration - Migrate to DbUp 4.0 #36

Closed johanclasson closed 5 years ago

johanclasson commented 6 years ago

Perhaps it is enough to point against NuGet package dbup-sqlserver.

drwatson1 commented 5 years ago

Johan, hi!

Is there any chance to update the task to DbUp 4.2?

johanclasson commented 5 years ago

When 4.0 came out I tried upgrading but had some issues that scripts did not get executed in the same order anymore (I have tests that cover execution order). I did not have the time to investigate it further then, I you like you are more than welcome to take a look!

Out of curiosity, what feature in 4.2 is it you want that 3.5.5 does not have?

drwatson1 commented 5 years ago

I use RunAlways to recreate views and run ordered groups to make sure it will run after update of db structure.

Ok. I'll try to do it and create a pr

johanclasson commented 5 years ago

Great. :) If you run into issues do not hesitate to send me a message and perhaps we can work it out together!

drwatson1 commented 5 years ago

I've updated DbUp to version 4.2 and it works. However, some tests are failed. For example, "'update database searching all folders ordering by filename'" is failed with an error:

String lengths are both 19. Strings differ at index 1. Expected: {04\02-data-good.sql} But was: {02\04-data-good.sql}

The code is here: https://github.com/drwatson1/vso-agent-tasks/tree/dbup42 If I run the test from the master branch it passes but if I run the same test from the dbup42 branch it fails. The problem is in FileSystemScriptProvider class. It works differently with a new version of DbUp and I can't imagine where the problem can be. As I can see all is ok, but don't work.

Do you have any idea?

drwatson1 commented 5 years ago

I've figured it out. Here is the same problem described. I'll try to cope with it.

johanclasson commented 5 years ago

Nice. Great find!

johanclasson commented 5 years ago

There were some reflection issues, #51. I will try to investigate.

drwatson1 commented 5 years ago

Hi Johan!

Do you have any idea what is happened? I can't read a text of an error in the issue.

Can I help you anyhow?

johanclasson commented 5 years ago

It very hard to read, yes, but I think it is: "ReflectionTypeLoadException. Unable to load one or more of the required types. Retrieve the LoaderExceptions property for more information."

My guess is that it happens when that shunk of c# code is loaded and that some dll is missing or cannot be read in.

Can be due to anything. Old PowerShell version? Old version of .NET Framework?

Or is it some mistake in the code that loads the dlls from the temp-folder?

My plan was to try running the task on agents on a few different machines and see what happens.

If we can't reproduce this I'm thinking we could release the 4.2-DbUp version as a new mayor version of the task. That way it will not affect anybodys present setup.

drwatson1 commented 5 years ago

Good idea. I'll try it too

johanclasson commented 5 years ago

I have released a 2.* version of the task where your contribution is included. Thanks again!