From 3fe1b4a3be05fe5184feb8bc237ceded5a98e8dc Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 5 Jul 2011 00:44:57 +0200 Subject: Fix and test issue 118. Clarify genmodel transformations. --- migrate/versioning/script/py.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'migrate/versioning/script/py.py') diff --git a/migrate/versioning/script/py.py b/migrate/versioning/script/py.py index 35fe4aa..3a090d4 100644 --- a/migrate/versioning/script/py.py +++ b/migrate/versioning/script/py.py @@ -25,7 +25,7 @@ class PythonScript(base.BaseScript): @classmethod def create(cls, path, **opts): """Create an empty migration script at specified path - + :returns: :class:`PythonScript instance `""" cls.require_notfound(path) @@ -38,7 +38,7 @@ class PythonScript(base.BaseScript): def make_update_script_for_model(cls, engine, oldmodel, model, repository, **opts): """Create a migration script based on difference between two SA models. - + :param repository: path to migrate repository :param oldmodel: dotted.module.name:SAClass or SAClass object :param model: dotted.module.name:SAClass or SAClass object @@ -50,7 +50,7 @@ class PythonScript(base.BaseScript): :returns: Upgrade / Downgrade script :rtype: string """ - + if isinstance(repository, basestring): # oh dear, an import cycle! from migrate.versioning.repository import Repository @@ -61,12 +61,12 @@ class PythonScript(base.BaseScript): # Compute differences. diff = schemadiff.getDiffOfModelAgainstModel( - oldmodel, model, + oldmodel, excludeTables=[repository.version_table]) # TODO: diff can be False (there is no difference?) decls, upgradeCommands, downgradeCommands = \ - genmodel.ModelGenerator(diff,engine).toUpgradeDowngradePython() + genmodel.ModelGenerator(diff,engine).genB2AMigration() # Store differences into file. src = Template(opts.pop('templates_path', None)).get_script(opts.pop('templates_theme', None)) @@ -86,7 +86,7 @@ class PythonScript(base.BaseScript): @classmethod def verify_module(cls, path): """Ensure path is a valid script - + :param path: Script location :type path: string :raises: :exc:`InvalidScriptError ` @@ -101,7 +101,7 @@ class PythonScript(base.BaseScript): return module def preview_sql(self, url, step, **args): - """Mocks SQLAlchemy Engine to store all executed calls in a string + """Mocks SQLAlchemy Engine to store all executed calls in a string and runs :meth:`PythonScript.run ` :returns: SQL file @@ -119,7 +119,7 @@ class PythonScript(base.BaseScript): return go(url, step, **args) def run(self, engine, step): - """Core method of Script file. + """Core method of Script file. Exectues :func:`update` or :func:`downgrade` functions :param engine: SQLAlchemy Engine -- cgit v1.2.1