Fix migration on older postgres
Since the move to oslo.db, sqlalchemy no longer raises ProgrammingError. Instead, it is wrapped in a oslo.db.exception.DBError. This causes migration to fail on older postgres, which relies on catching this error to use the correct constraint name. Change-Id: Icf7b20eb4e09f3c91aa3df3bcea497f810a6f907
This commit is contained in:
parent
d1d18b5013
commit
8c9c5020fd
|
@ -16,6 +16,7 @@
|
|||
import re
|
||||
|
||||
from migrate.changeset import UniqueConstraint
|
||||
from oslo.db import exception as db_exception
|
||||
from sqlalchemy import and_, func, orm
|
||||
from sqlalchemy import MetaData, Table
|
||||
from sqlalchemy.exc import OperationalError, ProgrammingError
|
||||
|
@ -34,7 +35,7 @@ def upgrade(migrate_engine):
|
|||
UniqueConstraint('image_id',
|
||||
name=_get_original_keyname(migrate_engine.name),
|
||||
table=image_members).drop()
|
||||
except (OperationalError, ProgrammingError):
|
||||
except (OperationalError, ProgrammingError, db_exception.DBError):
|
||||
UniqueConstraint('image_id',
|
||||
name=_infer_original_keyname(image_members),
|
||||
table=image_members).drop()
|
||||
|
|
Loading…
Reference in New Issue