Repeatable scripts

cplummer4cplummer4 Posts: 3
The current scripts that are generated... they support using transactions and rollback if unsuccessful. And that is useful...

However, is there any support for making the scripts fully repeatable? Namely, if I make a mistake and run these scripts more than once the database either gets too many rows inserted (if constraints are dropped) or stops on constraint errors. It would be nice if the script doesn't make any assumptions about the current state of the database, and will intelligently insert or update the rows, and finds existing rows based on the primary keys.

Problems do happen during deployment, or unforeseen circumstances that cause your script to fail, or successfully do inappropriate things. If a problem occurs I'd like to focus on fixing that one problem, instead of also worrying about the script that can't be rerun because it'll insert duplicate rows.

In other words, unless the script is repeatable you only get one shot at getting it right.

-Casey

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Casey,

    You would need to recompare the databases again if something happened during the synchronization script execution, then run the resulting script.

    There isn't a way to make the script safely reusable if you had run into a problem. Good point.

    In the future Red Gate wants to release something that can adapt (sort of like what the SQL Compare program can do with snapshots) so you wouldn't need to re-compare the two data sources again.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Note that unless you use the do not use transactions option, the data script is designed to roll back completely.
Sign In or Register to comment.