Pre/Post Deployment Scripts

SeriousMSeriousM Posts: 15
edited January 11, 2012 11:29AM in SQL Compare Previous Versions
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

Comments

  • 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
    David Atkinson
    Product Manager
    Redgate Software
  • This is simple:

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

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

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

    Post deployment script:
    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.
  • 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-de ... 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
    David Atkinson
    Product Manager
    Redgate Software
  • 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!
Sign In or Register to comment.