Database.SaveToFolder doesn't include 'Data' folder?
mjashton
Posts: 10 New member
I am doing the following, for experimentation purposes:
Which is:
- registering a database from a source-controlled folder of files, which includes source controlled static-data
- saving that database out to a new folder of files
I've noticed that none of the static-data is written out to the new tempDb folder, what am I missing?
The wrangling involving dbInfo was an attempt to fix this, thinking that re-using the existing db info loaded in step 1 would solve the problem but it didn't. The 'RedGateDatabaseInfo.xml' written out into tempDb has 'DataFileSet' and 'DataFile' entries I'd expect to see, but the 'Data' folder itself isn't in the directory structure.
When then doing a comparison between two dbs, one registered from the original source folder and the other registered from the tempDb folder, the data migration script thinks that all static data is missing so creates a script that attempts to insert all rows.
var targetDb = new Database(); targetDb.RegisterForDataCompare(options.DbDirectory.FullName,null,Options.Default); var dbInfo = targetDb.DbInfo; var outPath = Path.Combine(options.OutFilepath, 'tempDb'); if (!Directory.Exists(outPath)) { Directory.CreateDirectory(outPath); } targetDb.SaveToFolder(outPath, dbInfo);
Which is:
- registering a database from a source-controlled folder of files, which includes source controlled static-data
- saving that database out to a new folder of files
I've noticed that none of the static-data is written out to the new tempDb folder, what am I missing?
The wrangling involving dbInfo was an attempt to fix this, thinking that re-using the existing db info loaded in step 1 would solve the problem but it didn't. The 'RedGateDatabaseInfo.xml' written out into tempDb has 'DataFileSet' and 'DataFile' entries I'd expect to see, but the 'Data' folder itself isn't in the directory structure.
When then doing a comparison between two dbs, one registered from the original source folder and the other registered from the tempDb folder, the data migration script thinks that all static data is missing so creates a script that attempts to insert all rows.
Tagged:
Comments
To clarify, the Database class only stores schema information and Database.SaveToFolder() will only write out schema to a folder. The RegisterForDataCompare method creates a Database instance with limited schema information specifically relevant to Data Compare (ie mostly focusing on tables and views rather than other object types) which can then be fed into ComparisonSession and other related classes to do the actual data operations.
Thanks again.