For obvious reasons it's very important that scripts get run in the correct, predictable order.

DBUpdater simply does a string comparison when determining the order that scripts need to be run in.

So to ensure that your scripts get run in the correct order all you have to do is use a workable naming convention. This can be anything that works for you and your team but I recommend the following:-

yyyymmdd_descriptivename.sql

Having the date at the front (in reverse) tells you roughly when the script was created and works well with ordering using the string comparison.

99% of the time this will ensure that scripts get run in the correct order. Occasionally two scripts will be created on the same day and the order (based off the rest of the name) is the wrong way around (and actually matters). Just change the name slightly (add another character after the date) if this ever happens.

Another convention I have seen that works quite well is a simple numbering system, e.g. 101ScriptA.sql, 102scriptB.sql etc

Last edited May 25, 2008 at 4:33 AM by wallism, version 5

Comments

No comments yet.