Logo Search packages:      
Sourcecode: ibid version File versions  Download package

ibid::db::versioned_schema::VersionedSchema Class Reference

Inherited by ibid::db::models::Account::AccountSchema, ibid::db::models::Attribute::AttributeSchema, ibid::db::models::Credential::CredentialSchema, ibid::db::models::Identity::IdentitySchema, ibid::db::models::Permission::PermissionSchema, and ibid::db::models::Schema::SchemaSchema.

List of all members.

Detailed Description

For an initial table schema, set
table.versioned_schema = VersionedSchema(__table__, 1)
Table creation (upgrading to version 1) is implicitly supported.

When you have upgrades to the schema, instead of using VersionedSchema
directly, derive from it and include your own upgrade_x_to_y(self) methods,
where y = x + 1

In the upgrade methods, you can call the helper functions:
add_column, drop_column, rename_column, alter_column
They try to do the correct thing in most situations, including rebuilding
tables in SQLite, which doesn't actually support dropping/altering columns.
For column parameters, while you can point to columns in the table
definition, it is better style to repeat the Column() specification as the
column might be altered in a future version.

Definition at line 22 of file versioned_schema.py.

Public Member Functions

def __init__
def add_column
def add_index
def alter_column
def drop_column
def drop_index
def is_up_to_date
def rename_column
def upgrade_schema

Public Attributes


Static Public Attributes

tuple foreign_key_re = re.compile(r'^FOREIGN KEY\(.*?\) (REFERENCES .*)$', re.I)

Private Member Functions

def _create_table
def _get_reflected_model
def _index_name
def _mysql_constraint_createstring
def _rebuild_sqlite

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index