Red Gate forums :: View topic - Pre/Post Deployment Scripts
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Pre/Post Deployment Scripts

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
SeriousM



Joined: 27 Sep 2010
Posts: 11

PostPosted: Wed Jan 11, 2012 11:52 am    Post subject: Pre/Post Deployment Scripts Reply with quote

Hi,

we evaluate sql compare for azure db deployment and i wonder how i can add pre/post deployment scripts to the output?

do i need an additional product or do i miss something important?

thanks
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1122
Location: Twitter: @dtabase

PostPosted: Wed Jan 11, 2012 11:57 am    Post subject: Reply with quote

There's no provision in the the tool for this. Is there anything stopping you appying a separate script outside of SQL Compare?

I'm also interested to know what you intend to add to your pre and post deployment scripts.

Kind regards,

David Atkinson
Product Manager
Red Gate
Back to top
View user's profile Send private message Send e-mail
SeriousM



Joined: 27 Sep 2010
Posts: 11

PostPosted: Wed Jan 11, 2012 12:33 pm    Post subject: Reply with quote

This is simple:

Table before update:
Code:
[User]
'Name' (contains "Test Dummy")


Table change:
Code:
[User]
Rename 'Name' -> 'FirstName' (still contains "Test Dummy")
Add 'LastName' (defualt "not set")


Table after update:
Code:
[User]
'FirstName', 'LastName'


Post deployment script:
Code:
update [User]
set LastName = StringAfterFirstSpace(FirstName), FirstName = StringBeforeFirstSpace(FirstName)
where LastName = 'not set'


This is a silly simple example, but could occur.

Sure, i could execute this after i executed the schema update script, but i want to handle the whole update in a transaction.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1122
Location: Twitter: @dtabase

PostPosted: Wed Jan 11, 2012 1:45 pm    Post subject: Reply with quote

I see.

You're making a change that SQL Compare itself can't handle, as you're splitting a column and SQL Compare's script wouldn't have the knowledge to preserve your data.

There's good news and bad news.

The good news is that we can handle that via the addition of custom migration scripts. There's a video that describes how this works here:
http://www.red-gate.com/products/sql-development/sql-compare/deployment (it's the second one, called "A step by step guide through database deployment).

The bad news is that due to various implementation details this functionality doesn't work with SQL Azure. How often do you find yourself in situations where you need to add pre/post statements to your scripts? I think you'll have to carry on modifying SQL Compare's script manually for the time being, and hopefully we'll handle this in a later release.

David
Back to top
View user's profile Send private message Send e-mail
SeriousM



Joined: 27 Sep 2010
Posts: 11

PostPosted: Wed Jan 11, 2012 5:29 pm    Post subject: Reply with quote

Hi David,

thanks for the link to the video.

The migration script option is only available with the additional product "SQL Source Control 3.0" which we wont buy.

So we have to execute a custom pre/post deployment script and with this way we can handle the sql azure problem with ease.

Thanks!
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