Changes between Version 9 and Version 10 of TestManagerForTracPluginGenericClass


Ignore:
Timestamp:
Oct 15, 2012, 11:14:35 AM (2 years ago)
Author:
seccanj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TestManagerForTracPluginGenericClass

    v9 v10  
    146146
    147147[[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.
    149149
    150150[[BR]][[BR]]
    151151Well, actually before being able to use our new class, we must:
    152152 * '''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, it is 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
     155As you will see, this is far from complex. See the description below the code box.
    156156
    157157{{{
     
    271271
    272272[[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
     275If you need to '''upgrade the database schema''' in a subsequent release, the framework helps you with that.
     276
     277The 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.
    274278
    275279This directory will contain simple python files, one for each table and for each DB version upgrade, with a structure similar to the following.
    276280See a detailed explanation after the code box.
    277281Refer to [http://testman4trac.svn.sourceforge.net/viewvc/testman4trac/testman4trac/trunk/testmanager/upgrades/ the TestManager plugin upgrade directory] for a more complete example.
     282
     283These upgrade scripts must follow a specific '''naming convention''': '''db_<table name>_<version>'''.
     284
     285The 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
    278287{{{
    279288from trac.db import Table, Column, Index, DatabaseManager
     
    315324In case you need to update a table's structure (e.g. add columns), you will:
    316325
    317  1) Create a temporary table with the same structure as the old table
    318  2) Copy all the contents of the current table into the temporary table
    319  3) Drop the original table
    320  4) Recreate the original table with the new structure
    321  5) Copy back all the contents from the temporary table into the updated original table
    322  6) Drop the temporary table
     326 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
    323332
    324333[[BR]]