# HG changeset patch # User Marcin Kuzminski # Date 2013-04-15 23:45:47 # Node ID e203cd3640dbacfd005cd1f643d071b9fafedd04 # Parent 848492e2aafadd2ab01c0817f820b801570dcae9 sync sqlalchemy migrate with latest changes diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/schema.py b/rhodecode/lib/dbmigrate/migrate/versioning/schema.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/schema.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/schema.py @@ -7,7 +7,7 @@ import logging from sqlalchemy import (Table, Column, MetaData, String, Text, Integer, create_engine) from sqlalchemy.sql import and_ -from sqlalchemy import exceptions as sa_exceptions +from sqlalchemy import exc as sa_exceptions from sqlalchemy.sql import bindparam from rhodecode.lib.dbmigrate.migrate import exceptions @@ -20,6 +20,7 @@ from rhodecode.lib.dbmigrate.migrate.ver log = logging.getLogger(__name__) + class ControlledSchema(object): """A database under version control""" diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py b/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py @@ -10,6 +10,7 @@ from sqlalchemy.types import Float log = logging.getLogger(__name__) + def getDiffOfModelAgainstDatabase(metadata, engine, excludeTables=None): """ Return differences of model against database. @@ -17,7 +18,8 @@ def getDiffOfModelAgainstDatabase(metada :return: object which will evaluate to :keyword:`True` if there \ are differences else :keyword:`False`. """ - db_metadata = sqlalchemy.MetaData(engine, reflect=True) + db_metadata = sqlalchemy.MetaData(engine) + db_metadata.reflect() # sqlite will include a dynamically generated 'sqlite_sequence' table if # there are autoincrement sequences in the database; this should not be