run_migrations_offline¶
- safir.database.run_migrations_offline(metadata, url)¶
Run Alembic migrations in offline mode.
This function may only be called from the Alembic
env.py
file.This configures the context with just a URL and not an engine. By skipping the engine creation, the DBAPI does not have to be available. The migrations are sent to the script output.
- Parameters:
- Return type:
Examples
Normally this is called from
alembic/env.py
with code similar to the following:from alembic import context from safir.database import run_migrations_offline from example.config import config from example.schema import Base if context.is_offline_mode(): run_migrations_offline(Base.metadata, config.database_url)