def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
engine = db_api.get_engine()
connection = engine.connect()
target_metadata = db_models.MeteosBase.metadata
context.configure(connection=connection, # pylint: disable=E1101
target_metadata=target_metadata)
try:
with context.begin_transaction(): # pylint: disable=E1101
context.run_migrations() # pylint: disable=E1101
finally:
connection.close()
评论列表
文章目录