From: Mike Bayer Date: Sat, 28 Jul 2012 10:29:26 +0000 (-0400) Subject: - [feature] Added --sql argument to the "revision" command, X-Git-Tag: rel_0_3_6~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a282878eb15b5d56c63e056d63f67057c07414c;p=thirdparty%2Fsqlalchemy%2Falembic.git - [feature] Added --sql argument to the "revision" command, for the use case where the "revision_environment" config option is being used but SQL access isn't desired. --- diff --git a/CHANGES b/CHANGES index 1656c19b..7f2220a0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,11 +1,16 @@ 0.3.6 ===== -- Added year, month, day, hour, minute, second +- [feature] Added year, month, day, hour, minute, second variables to file_template. #59 -- Added 'primary' to the list of constraint types +- [feature] Added 'primary' to the list of constraint types recognized for MySQL drop_constraint(). +- [feature] Added --sql argument to the "revision" command, + for the use case where the "revision_environment" + config option is being used but SQL access isn't + desired. + 0.3.5 ===== - [bug] Fixed issue whereby reflected server defaults diff --git a/alembic/__init__.py b/alembic/__init__.py index e761d540..38e81077 100644 --- a/alembic/__init__.py +++ b/alembic/__init__.py @@ -1,6 +1,6 @@ from os import path -__version__ = '0.3.5' +__version__ = '0.3.6' package_dir = path.abspath(path.dirname(__file__)) diff --git a/alembic/command.py b/alembic/command.py index cefd9d95..518d6240 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -9,8 +9,8 @@ def list_templates(config): print "Available templates:\n" for tempname in os.listdir(config.get_template_directory()): readme = os.path.join( - config.get_template_directory(), - tempname, + config.get_template_directory(), + tempname, 'README') synopsis = open(readme).next() print "%s - %s" % (tempname, synopsis) @@ -60,7 +60,7 @@ def init(config, directory, template='generic'): util.msg("Please edit configuration/connection/logging "\ "settings in %r before proceeding." % config_file) -def revision(config, message=None, autogenerate=False): +def revision(config, message=None, autogenerate=False, sql=False): """Create a new revision file.""" script = ScriptDirectory.from_config(config) @@ -87,8 +87,9 @@ def revision(config, message=None, autogenerate=False): with EnvironmentContext( config, script, - fn = retrieve_migrations, - template_args = template_args, + fn=retrieve_migrations, + as_sql=sql, + template_args=template_args, ): script.run_env() script.generate_revision(util.rev_id(), message, **template_args) @@ -199,7 +200,7 @@ def stamp(config, revision, sql=False, tag=None): context._update_current_rev(current, dest) return [] with EnvironmentContext( - config, + config, script, fn = do_stamp, as_sql = sql, @@ -210,9 +211,9 @@ def stamp(config, revision, sql=False, tag=None): def splice(config, parent, child): """'splice' two branches, creating a new revision file. - + this command isn't implemented right now. - + """ raise NotImplementedError()