so that --sql mode gets access to naming conventions also.
existing environments need to add target_metadata to the offline migration
context manually.
fixes #189
"""
url = config.get_main_option("sqlalchemy.url")
- context.configure(url=url)
+ context.configure(url=url, target_metadata=target_metadata)
with context.begin_transaction():
context.run_migrations()
file_ = "%s.sql" % name
logger.info("Writing output to %s" % file_)
with open(file_, 'w') as buffer:
- context.configure(url=rec['url'], output_buffer=buffer)
+ context.configure(url=rec['url'], output_buffer=buffer,
+ target_metadata=target_metadata.get(name))
with context.begin_transaction():
context.run_migrations(engine_name=name)
"""
context.configure(
- url=meta.engine.url)
+ url=meta.engine.url, target_metadata=target_metadata)
with context.begin_transaction():
context.run_migrations()