Advantage Data Dictionary Upgrades

Advantage Concepts

Upgrading data dictionaries to a newer version is accomplished using SQL Scripts. Advantage Data Architect provides the Data Dictionary Differentiator to automatically create an SQL script. These scripts will provide you with a solid base to begin with; however, in most situations the scripts will need to be customized. These scripts can be executed by any client that can execute SQL statements.

Data Dictionary Differentiator

The Data Dictionary Differentiator works by comparing the metadata stored in two Advantage Data Dictionaries. An SQL script can then be generated that contains a mixture of SQL Data Definitions statements and system procedure calls to make one data dictionary the same as the other. To start the Data Dictionary Differentiator select Database | Compare Data Dictionaries in Advantage Data Architect. The differentiator does not compare data in the tables; it only compares the metadata stored in the data dictionary.

After starting the Data Dictionary Differentiator, select the old data dictionary as the first dictionary and the new data dictionary as the second dictionary. After clicking OK you will be prompted to log into both data dictionaries as the Administrative User, AdsSys. Once you have successfully authenticated into both dictionaries the two data dictionaries will be compared and a graphical representation of the differences will be displayed.

On the graphical display objects with a plus sign in front of them are only contained in that data dictionary, while a corresponding object with a negative sign will be shown in the other data dictionary to signify that object does not exist in this data dictionary. The properties of a single object can be displayed by pressing View. All other objects exist in both dictionaries; however, one or more of their properties are different. By clicking Diff the properties of the object in both data dictionaries will be shown with all properties that are different highlighted in red.

SQL Scripts are generated by clicking Write Script. An SQL script may be created for a single object, a subset of objects such as tables, or an entire data dictionary. This script should be treated as a template that will most likely need to be customized.

Customizing SQL Upgrade Scripts

Tables

The upgrade script uses SQL ALTER table statements to modify table structures. Each SQL ALTER statement assumes that all column names not found in the other table are new columns. If a column has been renamed, then the SQL statement must be modified to alter the column name rather than dropping the existing column and then adding a new column.

Record and Column Constraints

By default when applying new or altered record and column constraints, records that do not meet the constraint are appended to a fail table. This behavior can be modified to ignore records that do not meet the constraint or raise an error when a record that does meet the constraint is found.

Referential Integrity

By default the system procedure for adding referential integrity rules sp_CreateReferentialIntegrity deletes any records that do not satisfy the referential integrity rule. This system procedure can be modified so records that do not meet the rule are added to a fail table instead. See sp_CreateReferentialIntegrity for more details on this.

User Passwords

The upgrade script does not contain or modify user passwords, so by default all new users created will be created with an empty password.

Deploying the script

The SQL script must be run at each customer site when you upgrade your application. This can be performed using the Native SQL Interface in Advantage Data Architect if a person will be on site during the upgrade or, a custom upgrade program can be written. This program must be able to handle the data in the fail tables. If an error is encountered the program should be correct the problem and then execute the remaining portion of the script from the position of the failure.