DbUp: Variable X Has No Value Defined

A quick demo on how schema migrations works in DbUp took an interesting turn as we tried to insert some values into our database:

Until now I never had such a problem and we were a bit puzzled. Where is the variable a4 coming from? All we wanted to do is to run this insert command:

Executing the same script in SQL Server Management Studio worked without a problem, so DbUp may be the source of the problem. A few searches for different parts of the exception brought us to the chapter on variable substitution in the documentation of DbUp.

Our value had unfortunately the form of a variable that DbUp tried to substitute. We don’t want to substitute variables and could therefore disable this feature with one additional line in the setup code:

Running DbUp once more inserted our data without a problem:

 

Conclusion

Some features of a library can be found only by accident. Luckily for us the substitution of variables is one that can be turned off without much work. I hope you can use this post to fix our problem when DbUp has a problem with your data.

2 thoughts on “DbUp: Variable X Has No Value Defined”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.