Search code examples
redgatesqlmigrations

Can I undo 'Mark as Deployed' option in ReadyRoll?


I marked 2 scripts as deployed and checked in my changes to TFS. Can I undo this in the ReadyRoll project?


Solution

  • When you click Mark as Deployed, ReadyRoll inserts a row into the [__MigrationLog] table within the target database in order to prevent the script from being re-executed.

    In order to undo this, simply delete the record from the target database, e.g.

    DELETE FROM [dbo].[__MigrationLog] WHERE script_filename = '0001_20161125-1446_username.sql'

    If you have many servers to undo 'mark as deployed':

    • If the script is a Migration, generate a new guid and replace the value within the <Migration ID="{guid}"/> metadata (which can be found within the header of your script).
    • If the script is a Programmable Object, then simply add a make a trivial change to the file (e.g. add some white space). This is enough to trigger a change to the checkum, causing the script to be re-deployed.