table.drop() raises ProgrammingError in SQLAlchemy 0.7 instead of SQLError (addresses #112)
This commit is contained in:
parent
20df98c44d
commit
2836390634
@ -11,6 +11,7 @@ from sqlalchemy import exceptions as sa_exceptions
|
|||||||
from sqlalchemy.sql import bindparam
|
from sqlalchemy.sql import bindparam
|
||||||
|
|
||||||
from migrate import exceptions
|
from migrate import exceptions
|
||||||
|
from migrate.changeset import SQLA_07
|
||||||
from migrate.versioning import genmodel, schemadiff
|
from migrate.versioning import genmodel, schemadiff
|
||||||
from migrate.versioning.repository import Repository
|
from migrate.versioning.repository import Repository
|
||||||
from migrate.versioning.util import load_model
|
from migrate.versioning.util import load_model
|
||||||
@ -57,10 +58,16 @@ class ControlledSchema(object):
|
|||||||
"""
|
"""
|
||||||
Remove version control from a database.
|
Remove version control from a database.
|
||||||
"""
|
"""
|
||||||
try:
|
if SQLA_07:
|
||||||
self.table.drop()
|
try:
|
||||||
except (sa_exceptions.SQLError):
|
self.table.drop()
|
||||||
raise exceptions.DatabaseNotControlledError(str(self.table))
|
except sa_exceptions.ProgrammingError:
|
||||||
|
raise exceptions.DatabaseNotControlledError(str(self.table))
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
self.table.drop()
|
||||||
|
except (sa_exceptions.SQLError):
|
||||||
|
raise exceptions.DatabaseNotControlledError(str(self.table))
|
||||||
|
|
||||||
def changeset(self, version=None):
|
def changeset(self, version=None):
|
||||||
"""API to Changeset creation.
|
"""API to Changeset creation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user