Script from source control with migration scripts?

sab39sab39 Posts: 10
Is there a way to use the command line to generate an SQL script that takes into account migration scripts in source control, or does this require the beta V2 migration system?

I'd like to be able to point to my source control repository (both database and migration scripts folders) and a real database and get output of a single .sql script that would update that database to match what's in source control - including any migration scripts associated with it.

Is this possible?

If it requires the beta migration tools, is there an ETA for when they will no longer be in beta? How reliable are they in their currently released form?

Comments

  • Hello,

    Thanks for your post.

    This should work with SQL Compare (one thing to note is that there's a bug in 10.7 that causes retrieval of migration scripts to fail).

    You'll need to use the following switches:
    /sourcecontrol1
    /revision1:<revision # or "head">
    /server2:<target server>
    /database2:<target database>
    /sfx:<xml file with source control location>
    /mfx:<xml file with migration folder location>
    /ScriptFile:<path to .sql script you want to generate>
    

    To create the xml files for sfx and mfx, you'll need to look at the extended properties of your linked database. The sfx xml file should be the value of "SQLSourceControl Scripts Location" and the mfx xml file should be the value of "SQLSourceControl Migration Scripts Location".

    Here's the documentation on our switches: http://documentation.red-gate.com/displ ... mmand+line (note: it says the sfx and mfx switches are deprecated, but as far as I know they're the only way to get this to work).

    Hope that helps.

    Thanks,
    Evan
    Evan Moss
    Product Support
    (866) 627-8107
  • Thanks for your help!

    I managed to figure it out with trial and error and googling. I avoided the 10.7 bug by sheer luck of the fact that the Automation Pack apparently contains a v11 beta :)
Sign In or Register to comment.