# `CommandUpgrade`

The CommandUpgrade class is accessible via the `sqlobject.manager.command` module.

## Attributes

#### a `min_args`

    0

#### a `help`

    'This command runs scripts (that you write by hand) to upgrade a database.  The database\'s current version is in the sqlobject_version table (use record --force-db-version if a database does not have a sqlobject_version table), and upgrade scripts are in the version directory you are upgrading FROM, named upgrade_DBNAME_VERSION.sql, like "upgrade_mysql_2004-12-01b.sql".'

#### a `parser`

    <optparse.OptionParser instance at 0xa8d8e2c>

#### a `aliases`

    ()

#### a `max_args`

    0

#### a `max_args_error`

    'You must provide no more than %(max_args)s arguments'

#### a `description`

    None

#### a `prog_name`

    <property object at 0xa8f016c>

#### a `name`

    'upgrade'

#### a `summary`

    'Update the database to a new version (as created by record)'

#### a `min_args_error`

    'You must provide at least %(min_args)s arguments'

#### a `version_regex`

    <_sre.SRE_Pattern object at 0xa386c20>

#### a `upgrade_regex`

    <_sre.SRE_Pattern object at 0xa99e568>

#### a `required_args`

    []

## Methods

#### f `__sizeof__(...)` ...

__sizeof__() -> int size of object in memory, in bytes

#### f `__format__(...)` ...

default object formatter

#### f `__subclasshook__(...)` ...

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

#### f `orderClassesByDependencyLevel(self, classes)` ...

Return classes ordered by their depth in the class dependency tree (this is not the inheritance tree), from the top level (independant) classes to the deepest level. The dependency tree is defined by the foreign key relations.

#### f `__classinit__(cls, new_args)` ...

#### f `__init__(self, invoked_as, command_name, args, runner)` ...

#### f `run(self)` ...

#### f `classes(self, require_connection=True, require_some=False)` ...

#### f `classes_from_module(self, module)` ...

#### f `connection(self)` ...

#### f `config(self)` ...

#### f `ini_config(self, conf_fn)` ...

#### f `classes_from_package(self, package_name)` ...

#### f `classes_from_egg(self, egg_spec)` ...

#### f `load_options_from_egg(self, egg_spec)` ...

#### f `config_from_egg(self, egg_spec, warn_no_sqlobject=True)` ...

#### f `ask(self, prompt, safe=False, default=True)` ...

#### f `shorten_filename(self, fn)` ...

Shortens a filename to make it relative to the current directory (if it can). For display purposes.

#### f `open_editor(self, pretext, breaker=None, extension='.txt')` ...

Open an editor with the given text. Return the new text, or None if no edits were made. If given, everything after breaker will be ignored.

#### f `update_db(self, version, conn)` ...

#### f `strip_comments(self, sql)` ...

#### f `base_dir(self)` ...

#### f `find_output_dir(self)` ...

#### f `find_last_version(self)` ...

#### f `command_force_db_version(self)` ...

#### f `command(self)` ...

#### f `current_version(self)` ...

#### f `make_plan(self, current, dest)` ...

#### f `best_upgrade(self, current, dest, target_dbname)` ...

See the source for more information.