THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class IMigrator(ABC): (source)
Known subclasses: orionis.database.migrations.Migrator
Contract for the database migration runner.
Implementations discover migration files under the application's database/migrations directory, track which ones have already been applied, and apply or revert them in chronological order against any configured connection.
| Async Method | fresh |
Drop the tracking table and apply every migration from scratch. |
| Async Method | migrate |
Apply every migration that has not been run yet. |
| Async Method | refresh |
Roll back migrations and immediately apply them again. |
| Async Method | reset |
Revert every migration recorded on the connection. |
| Async Method | rollback |
Revert the most recently applied migration batches. |
| Async Method | status |
Report which migrations are applied and which are pending. |
| Class Variable | __slots__ |
Undocumented |
str | None = None, events: MigrationEvents | None = None) -> list[ str]:
(source)
¶
orionis.database.migrations.MigratorDrop the tracking table and apply every migration from scratch.
| Parameters | |
connection:str or None, optional | Named connection to rebuild, or None for the default. |
events:MigrationEvents or None, optional | Progress callbacks reported for each migration. |
| Returns | |
list of str | Names of the migrations applied, in the order they ran. |
str | None = None, events: MigrationEvents | None = None) -> list[ str]:
(source)
¶
orionis.database.migrations.MigratorApply every migration that has not been run yet.
| Parameters | |
connection:str or None, optional | Named connection to migrate, or None for the default one. |
events:MigrationEvents or None, optional | Progress callbacks reported for each migration. |
| Returns | |
list of str | Names of the migrations applied, in the order they ran. Empty when there is nothing pending. |
| Raises | |
Exception | Any exception raised by a migration's up method aborts the run and propagates to the caller. |
int | None = None, *, connection: str | None = None, events: MigrationEvents | None = None) -> list[ str]:
(source)
¶
orionis.database.migrations.MigratorRoll back migrations and immediately apply them again.
| Parameters | |
steps:int or None, optional | Number of batches to roll back first; None rolls back every recorded migration. |
connection:str or None, optional | Named connection to refresh, or None for the default. |
events:MigrationEvents or None, optional | Progress callbacks reported for each migration. |
| Returns | |
list of str | Names of the migrations re-applied, in the order they ran. |
| Raises | |
ValueError | If steps is not a positive integer. |
str | None = None, events: MigrationEvents | None = None) -> list[ str]:
(source)
¶
orionis.database.migrations.MigratorRevert every migration recorded on the connection.
| Parameters | |
connection:str or None, optional | Named connection to reset, or None for the default one. |
events:MigrationEvents or None, optional | Progress callbacks reported for each migration. |
| Returns | |
list of str | Names of the migrations reverted, most recent first. |
| Raises | |
MigrationNotFoundException | If a recorded migration has no matching migration file. |
int = 1, *, connection: str | None = None, events: MigrationEvents | None = None) -> list[ str]:
(source)
¶
orionis.database.migrations.MigratorRevert the most recently applied migration batches.
| Parameters | |
steps:int, optional | Number of batches to roll back, starting from the most recent one. Defaults to 1. |
connection:str or None, optional | Named connection to roll back, or None for the default. |
events:MigrationEvents or None, optional | Progress callbacks reported for each migration. |
| Returns | |
list of str | Names of the migrations reverted, most recent first. Empty when there is nothing to revert. |
| Raises | |
ValueError | If steps is not a positive integer. |
MigrationNotFoundException | If a recorded migration has no matching migration file. |