Package gavo :: Package user :: Module upgrade :: Class Upgrader
[frames] | no frames]

Class Upgrader

source code

object --+
         |
        Upgrader
Known Subclasses:

A specification to upgrade from some schema version to another schema version.

Upgraders live as uninstanciated classes. Their version attribute gives the version their instructions update *from*; their destination version therefore is version+1.

Each upgrader has attributes named u_<seqno>_<something>. These can be either strings, which are then directly executed in the database, or class methods, which will be called with a connection argument. You must not commit this connection. You must not swallow exceptions that have left the connection unready (i.e., require a rollback).

Note that if you run rsc.makeData, you MUST pass both connection=connection and runCommit=False in order to avoid messing people's lives up.

The individual upgrader classmethods will be run in the sequence given by the sequence number.

The updaters should have 1-line docstrings explaining what they do.

The update of the schemaversion is done automatically, you don't need to worry about it.

Instance Methods

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
updateSchemaversion(cls, connection) source code
 
iterStatements(cls)
returns strings and classmethods that, in all, perform the necessary upgrade.
source code
Class Variables
  version = None
hash(x)
Properties

Inherited from object: __class__