The oslo_db.sqlalchemy.migration Module

oslo_db.sqlalchemy.migration.db_sync(engine, abs_path, version=None, init_version=0, sanity_check=True)

Upgrade or downgrade a database.

Function runs the upgrade() or downgrade() functions in change scripts.

Parameters:
  • engine – SQLAlchemy engine instance for a given database
  • abs_path – Absolute path to migrate repository.
  • version – Database will upgrade/downgrade until this version. If None - database will update to the latest available version.
  • init_version – Initial database version
  • sanity_check – Require schema sanity checking for all tables
oslo_db.sqlalchemy.migration.db_version(engine, abs_path, init_version)

Show the current version of the repository.

Parameters:
  • engine – SQLAlchemy engine instance for a given database
  • abs_path – Absolute path to migrate repository
  • init_version – Initial database version
oslo_db.sqlalchemy.migration.db_version_control(engine, abs_path, version=None)

Mark a database as under this repository’s version control.

Once a database is under version control, schema changes should only be done via change scripts in this repository.

Parameters:
  • engine – SQLAlchemy engine instance for a given database
  • abs_path – Absolute path to migrate repository
  • version – Initial database version