Cross-database reference support -broken?
christianacca
Posts: 24 Bronze 1
I've followed the guidance here: Cross-database reference support
But when I run readyroll (press the create database button), the deployment fails with the following error:
'Series5Doc' scripting variable not defined
Ram.Series5.Db
...Migrations\1.0.0\001.sql
What am I doing wrong?
Here is the screen shot of creating the database reference:
But when I run readyroll (press the create database button), the deployment fails with the following error:
'Series5Doc' scripting variable not defined
Ram.Series5.Db
...Migrations\1.0.0\001.sql
What am I doing wrong?
Here is the screen shot of creating the database reference:
Tagged:
Comments
CREATE SYNONYM [dbo].[BinaryFileTable] FOR [$(Series5Doc)].[dbo].[BinaryFile]
GO
As a work-around, try adding $(Series5Doc) manually to the SQLCMD Variables tab with the appropriate database name as the default value. Does that allow you to deploy successfully?
Product Manager
Redgate Software
Yup, I knew that I could manually create a variable as you suggest.
Once the regression is fixed can you confirm whether the following is the expected behavior:
1. A SQLCMD variable will be made available to reference in migrations without having to manually create one myself
2. The variable will be added to the "SQLCMD package (.sql file)" alongside the variables I have manually created
3. The value of this variable added to the "SQLCMD package (.sql file)" will be the database defined in the connection string used by referenced database project
Out of interest, what other behavior is added to the readyroll build system aside from making a variable available?
Thanks
Christian
Apologies for the delay in responding. That is indeed the expected behaviour of the variables when database references are added to the project. The only additional thing that database refs do is ensure that the solution is deployed in the correct order of dependency, i.e. if ProjectB depends on ProjectA, it ensures that ProjectA deploys first.
In point-of-fact, there wasn't a substantial uptake of the Add Database Reference feature mentioned in the above forum post (which was released back in 2012). Due to the amount of up-front work involved in setting up the synonyms, most customers tend to just set the deployment order in the VS solution (instead of adding db references) and simply leave their cross-db objects refs as static references, i.e. SELECT * FROM OtherDb.dbo.MyTable). Of course, this only work in scenarios where the database names are the same each environment.
Product Manager
Redgate Software
What's the ETA for a release with a fix for this bug?
Thanks
Thanks for your patience.
Product Manager
Redgate Software
Hi Daniel,
Any update if this issue was fixed and if there are any other known issues currently with cross database support? Our team has been using ReadyRoll on other projects but just came across the first project that has a need for cross database functionality and are deciding the "best way" to handle it.
Thank you
The recommended approach for doing multi-database development at this stage is to simply retain the static names used in three and four part object references (e.g. SELECT * FROM [OtherDb].[dbo].[TableName] or SELECT * FROM [OtherServer].[OtherDb].[dbo].[TableName]) and set the Build Order in the Solution Explorer to reflect the dependencies between each database/project.
Any questions please let me know.
Product Manager
Redgate Software