<- Back to Database Upgrade ManagerConfigurationThe upgrade files are required to be located in a single directory. The directory must contain:
An example configuration directory, including a sample control file is included with the zip file. The Database Upgrade Manager is intended to support two scenarios: a) The Database Upgrade Manager executable, configuration settings and scripts are sent out as a single package (this can either be run directly, eg from a CD or wrapped into an installer program). In this scenario, the configuration settings and scripts should be located in a directory "config" under the directory of the executable. This is the default setting and requires no command line arguments. Unless the /p command line argument is specified, the application will check for a "config" directory below the application directory on startup. If the config directory exists and the config.xml file is found, the config.xml file will be automatically loaded and display the Pre-Install confirmation screen. b) In the second scenario, the Database Upgrade Manager is installed on the client's PC and only the configuration settings and scripts are sent out for the upgrade. The client can then run the pre-installed application and select the directory containing the upgrade files. The easiest implementation for this scenario is not to create a "config" directory from the application directory, however the /p (prompt) command line argument can be used to force the user to be prompted for a directory. Configuration FileThe configuration file contains information about the product being updated to allow customisation. The configuration file must be called config.xml
Control FileThe control file has three sections:
The the xsd for the Control File is included in the installation. Using the Post ProcessThe intention of the Post Process was to use a table similar to the following which is populated with a version number (note that here I've used a character version number, which makes the next bit easy, but for the next check to work the version number will need to be zero padded - eg: 01.01.01. You should also add a unique key constraint on the product code)CREATE TABLE [dbo].[MyProductVersion] ( [ProductCode] [Varchar](20) NOT NULL, [Description] [varchar](200) NULL, [Version] [varchar](20) NOT NULL ) Create the first transaction block as: and the first script that is processed can then do something like: if exists (select productcode from MyProductVersion where productcode = 'MYCODE' and version > '01.01.01') raiserror('Database already upgraded!', 11, 1) The Post Process will only be run if ALL scripts in the control file executed successfully, so the in the post process you can then update the version number if everything worked successfully. with a script similar to (with appropriate transaction handling): if exists (select ProductCode from dbo.MyProductVersion where ProductCode = 'MYCODE') delete from dbo.MyProductVersion where ProductCode = 'MYCODE' insert into dbo.MyProductVersion (ProductCode, Description, Version) values ('MYCODE', 'My Product Description', '01.02.00') |
||||||||||||||||||||||||||