Quote
Do people just use
scripts? etc.
We have a rather simple (but sometimes difficult to understand) way of
making sure all our customer databases are exactly the same structure. It is
based on some key factors:
- all changes are done after each other in exactly the same sequence on each
database
- all changes are done by running a special program
- everyone runs all scripts to get from version x to version y
You start with a database version 1.0 that contains two extra tables:
<version>and <scripts>. The specialist program (vtwscripter, vtw is dutch
for RFC) looks for a sub-directory with exactly the same name as the
version. If the sub-directory does not exist it displays a message and
enables 'exit' otherwise it enables 'go'. The end-user/dba presses 'go'. The
program checks wether or not it contains script
<version>_0001_<whatever>.sql. If it exists it runs the script, on succes or
failure it stores the script (and the response of the db) in the <scripts>
table. On error it stops displaying the reason. On succes it looks for
script <version>_0002-<whatever>.sql etc. etc. If for example the next
script is numbered <version>_0003_<whatever>.sql it refuses to go on. If the
next script is not present it assumes that it is finished and stops.
To change a version number we use a special numer:
<version>_9999_<whatever>.sql The scripter then resumes at 0001 in the new
sub-directory and so on. If a script is obsolete but other scripts have
already been made
(and thus numbered) the script's statements are replaced with a dummy
statment. All scripts are run in a transaction (DDL statements will not be
rolled back however).
All our programs (web/windows) check upon statup wether or not the database
version it the one they expect, if not they exit.
We now never have to worry wether or not a script has been run, if the
sequence in which the scripts were run was correct etc. etc. Furthermore the
distribution of the scripts etc. is rather easy and installation and running
can be done by almost every end-user.
Of course all kinds of mishap can still happen (somebody changing the
db-structure through another tool etc.) but basically it is simple and fool
proof and every update can be repeated over and over.
hth
Martin