Phase Two: implement the dbsetup functionality: So, generally, you'll only need to perform the full setup if there is a failure that executes part of your DDL in the new schemaSpec, but not all of it. Note: you could have actually run "mvn -Ddbsetup install" the first time around, but it would have unnecessarily dropped your schema, then added it back, only to execute the small upgrade step. ![]() To do this, simple do a dbsetup by executing "mvn -Ddbsetup install" If you have issues along the way (syntax errors in your SQL, incorrectly formatted XML element, etc), you can restart your test by getting your database back to the state it was in before the upgrade task was run. This will execute only the new schemaSpecs you have added to the db-upgrade.xml file. To test the upgrade, run "mvn -Ddbsetup-upgrade install" from the dbutils module. Note: do NOT at this point increment the element in the dbutils module's pom.xml There are examples of doing this in the db-upgrade.xml file, just mimic what they do. However, if you must use version/vendor specific SQL statements, you can target the database you want to execute the SQL on by using the appropriate db-upgrade ANT task definitions. ![]() Try your best to use generic SQL that is compatible across all database versions and vendors. perform the necessary SQL commands to add/remove/modify your new table definitions). Add the appropriate SQL statements to move an existing "old" schema into whatever the "new" schema will be (i.e. ![]() Add a new schemaSpec element and increment the version attribute by 1. Phase One: implement the db-upgrade functionality:įirst, edit db-upgrade.xml. If you run dbupgrade, it will read your current version by scanning the rhq_sytem_config table for the property named 'DB_SCHEMA_VERSION', and then execute all elements from db-upgrade.xml that are strictly greater than your current version at the end of this processing, it will overwrite the 'DB_SCHEMA_VERSION' property in the rhq_system_config table with the version attribute of the last schemaSpec element it successfully executed If you run dbsetup, it will combine the *-schema.xml into a file called all-schema.xml and use the property in the dbutils pom to seed your rhq_system_config property with the name 'DB_SCHEMA_VERSION' Your current schema version - this is based off of the last time you ran either the dbsetup or dbupgrade commands: First, there are a few concepts to understand:ĭbsetup - setup is based off of the *-schema.xml files located in /rhq/trunk/modules/core/dbutils/src/main/scripts/dbsetup/ for the various tables that make up the RHQ data modelĭbupgrade - this is based off of the single db-upgrade.xml file located at a=blob f=modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |