diff --git a/master/buildbot/db/model.py b/master/buildbot/db/model.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/db/model.py
+++ b/master/buildbot/db/model.py
@@ -21,10 +21,14 @@ import sqlalchemy as sa
 import migrate
 import migrate.versioning.schema
 import migrate.versioning.repository
-import migrate.versioning.exceptions
 from twisted.python import util, log
 from buildbot.db import base
 
+try:
+    from migrate import exceptions
+except ImportError:
+    from migrate.versioning import exceptions
+
 class Model(base.DBConnectorComponent):
     """
     DBConnector component to handle the database model; an instance is available
@@ -345,7 +349,7 @@ class Model(base.DBConnectorComponent):
                 # migrate.api doesn't let us hand in an engine
                 schema = migrate.versioning.schema.ControlledSchema(engine, self.repo_path)
                 db_version = schema.version
-            except migrate.versioning.exceptions.DatabaseNotControlledError:
+            except exceptions.DatabaseNotControlledError:
                 return False
 
             return db_version == repo_version
Fix integration with SQLAlchemy-migrate-<I>.

SQLAlchemy-migrate moved all exceptions to migrate.exceptions.