Red Gate forums :: View topic - Mapping Dependencies Problem
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control 1
SQL Source Control 1 forum

Mapping Dependencies Problem

Search in SQL Source Control 1 forum
Post new topic   Reply to topic
Jump to:  
Author Message
Simon Quin



Joined: 17 Aug 2010
Posts: 2

PostPosted: Tue Aug 17, 2010 2:08 pm    Post subject: Mapping Dependencies Problem Reply with quote

Is there any way to force the dependencies between database objects when creating a database from scratch from Source Control?

We have an issue on a few of our database tables where we have a default constraint that uses an user defined function to get a value. The function uses some standing data to provide the default value.

This means we have a dependency chain on the creation of the standing data table > function > table using function as a default constraint.

In our current (less than ideal) script-based solution this is no problem as we hand craft the scripts in the correct order.

I realize that this is an unusual situation, I wondered if there was any way to overcome it with a consistent automated approach?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6582

PostPosted: Wed Aug 18, 2010 5:14 pm    Post subject: Reply with quote

Hello Simon,

The idea behind SQL Source Control is to automatically create SQL scripts from a live database. This it can do while considering dependencies.

If you wanted to create a new database from SQL files in source control managed by SQL Source Control, all that you would need to do is create a new database, then use SQL Source Control to link the new database to your repository files, and commit the changes. The new database schema will be populated in dependency-order so it matches the files in the repository.

If you want to automate this, you could create a batch script to first, check out the latest version of the files in the repository and second to use SQLCOMPARE.exe (the command-line version of SQL Compare) to synchronize the database schema with the scripts.

It may be important to note that either solution works best with scripts produced by either Red Gate tool, as custom scripts may cause dependency issues on their own.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group