Sync Python Module

The ORM Sync Module.

class pacifica.metadata.orm.sync.MetadataSystem(*args, **kwargs)[source]

Metadata Schema Version Model.

DoesNotExist

alias of MetadataSystemDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
classmethod get_or_create_version()[source]

Set or create the current version of the schema.

classmethod get_version()[source]

Get the current version as a tuple.

classmethod is_equal()[source]

Check to see if schema version matches code version.

classmethod is_safe()[source]

Check to see if the schema version is safe for the code.

part = <CharField: MetadataSystem.part>
value = <IntegerField: MetadataSystem.value>
class pacifica.metadata.orm.sync.OrmSync[source]

Special module for syncing the orm.

This module should incorporate a schema migration strategy.

The supported versions migrating forward must be in a versions array containing tuples for major and minor versions.

The version tuples are directly translated to method names in the orm_update class for the update between those versions.

Example Methods:

class OrmSync:
  versions = [
    (0, 1),
    (0, 2),
    (1, 0),
    (1, 1)
  ]

  def update_0_1_to_0_2():
    pass
  def update_0_2_to_1_0():
    pass

The body of the update should follow peewee migration practices. http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#migrate

static close()[source]

Close the database connection.

classmethod connect_and_check()[source]

Connect and check the version.

static create_tables()[source]

Create the tables for the objects if they exist.

static dbconn_blocking()[source]

Wait for the db connection.

classmethod update_0_1_to_1_0()[source]

Update schema to 1.0.

classmethod update_1_0_to_2_0()[source]

Update to the schema to move proposal to project.

classmethod update_2_0_to_2_1()[source]

Update to the schema to move proposal to project.

classmethod update_2_1_to_3_0()[source]

Update to the schema to create relationships.

classmethod update_3_0_to_4_0()[source]

Update to the schema to create relationships.

classmethod update_tables()[source]

Update the database to the current version.

versions = [(0, 1), (1, 0), (2, 0), (2, 1), (3, 0), (4, 0)]