is_database_current

async safir.database.is_database_current(engine, logger=None, config_path=PosixPath('alembic.ini'))

Check whether the database schema is at the current version.

Every entry point to the application other than ones dedicated to updating the schema should normally call this function after creating the database engine and abort if it returns False.

Parameters:
  • engine (AsyncEngine) – Database engine to use.

  • logger (BoundLogger | None, default: None) – Logger to which the schema mismatch will be reported if the schema is out of date.

  • config_path (Path, default: PosixPath('alembic.ini')) – Path to the Alembic configuration.

Returns:

True if Alembic reports the database schema is current, False otherwise.

Return type:

bool