front-ends can re-use the argument parsing built
in. #70
+- [bug] Fixed the "multidb" template which was badly out
+ of date. It now generates revision files using
+ the configuration to determine the different
+ upgrade_<xyz>() methods needed as well, instead of
+ needing to hardcode these. Huge thanks to
+ BryceLohr for doing the heavy lifting here. #71
+
- [bug] Fixed the regexp that was checking for .py files
in the version directory to allow any .py file through.
Previously it was doing some kind of defensive checking,
script = ScriptDirectory.from_config(config)
template_args = {
- 'config': config # Let templates use config for e.g. multiple databases
+ 'config': config # Let templates use config for
+ # e.g. multiple databases
}
imports = set()
# access to the values within the .ini file in use.
config = context.config
-# Interpret the config file for Python logging.
+# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
logger = logging.getLogger(__name__)
downgrade_token="%s_downgrades",
target_metadata=target_metadata.get(name)
)
- context.execute("-- running migrations for database %s" % name)
context.run_migrations(engine_name=name)
if USE_TWOPHASE:
eval("downgrade_%s" % engine_name)()
<%
- db_names = context.get("config").get_main_option("databases")
+ db_names = config.get_main_option("databases")
%>
+## generate an "upgrade_<xyz>() / downgrade_<xyz>()" function
+## for each database name in the ini file.
+
% for db_name in re.split(r',\s*', db_names):
def upgrade_${db_name}():