Changes between Version 9 and Version 10 of TestManagerForTracPluginGenericClass
- Timestamp:
- Oct 15, 2012, 9:14:35 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TestManagerForTracPluginGenericClass
v9 v10 146 146 147 147 [[BR]] 148 '''This is it!!! ''' Our new class is ready to be used, with all the features outlined at the top of this page.148 '''This is it!!! ''' Our new class is ready to be used, with all the features outlined at the top of this page. 149 149 150 150 [[BR]][[BR]] 151 151 Well, actually before being able to use our new class, we must: 152 152 * '''Define our concrete class provider''', implementing the '''IConcreteClassProvider''' interface, and 153 * '''Declare the data model''' to be created into the Trac DB. 154 155 But, as you will see, itis far from complex. See the description below the code box.153 * '''Declare the data model''' to be created into the Trac DB. The database will be created (and updated) by the framework. 154 155 As you will see, this is far from complex. See the description below the code box. 156 156 157 157 {{{ … … 271 271 272 272 [[BR]] 273 One note about upgrade. The call to "upgrade_db_for_realm" specifies, as the second parameter, the subdirectory where all of the DB upgrade scripts will be provided. 273 === Upgrading the Database === 274 275 If you need to '''upgrade the database schema''' in a subsequent release, the framework helps you with that. 276 277 The call to '''upgrade_db_for_realm''', in the code above, specifies as the second parameter the subdirectory where all of the DB upgrade scripts will be provided. 274 278 275 279 This directory will contain simple python files, one for each table and for each DB version upgrade, with a structure similar to the following. 276 280 See a detailed explanation after the code box. 277 281 Refer to [http://testman4trac.svn.sourceforge.net/viewvc/testman4trac/testman4trac/trunk/testmanager/upgrades/ the TestManager plugin upgrade directory] for a more complete example. 282 283 These upgrade scripts must follow a specific '''naming convention''': '''db_<table name>_<version>'''. 284 285 The following script form TestManager plugin, for example, is named "db_testcaseinplan_2", meaning that it will upgrade the "testcaseinplan" table up from version 1 to version 2. 286 278 287 {{{ 279 288 from trac.db import Table, Column, Index, DatabaseManager … … 315 324 In case you need to update a table's structure (e.g. add columns), you will: 316 325 317 1 )Create a temporary table with the same structure as the old table318 2 )Copy all the contents of the current table into the temporary table319 3 )Drop the original table320 4 )Recreate the original table with the new structure321 5 )Copy back all the contents from the temporary table into the updated original table322 6 )Drop the temporary table326 1. Create a temporary table with the same structure as the old table 327 2. Copy all the contents of the current table into the temporary table 328 3. Drop the original table 329 4. Recreate the original table with the new structure 330 5. Copy back all the contents from the temporary table into the updated original table 331 6. Drop the temporary table 323 332 324 333 [[BR]]