Merge "Use with_variant method for dialects db types"

This commit is contained in:
Jenkins 2014-07-30 17:31:19 +00:00 committed by Gerrit Code Review
commit d794d08302
2 changed files with 4 additions and 9 deletions

View File

@ -24,6 +24,7 @@ from sqlalchemy import orm as sa_orm
from murano.common import uuidutils
from murano.db import session as db_session
from murano.db.sqla import types as st
from murano.openstack.common import timeutils
@ -265,7 +266,7 @@ class Package(BASE, ModificationsTrackedObject):
id = sa.Column(sa.String(36),
primary_key=True,
default=uuidutils.generate_uuid)
archive = sa.Column(sa.LargeBinary)
archive = sa.Column(st.LargeBinary())
fully_qualified_name = sa.Column(sa.String(512),
nullable=False,
index=True,
@ -283,7 +284,7 @@ class Package(BASE, ModificationsTrackedObject):
secondary=package_to_tag,
cascade='save-update, merge',
lazy='joined')
logo = sa.Column(sa.LargeBinary, nullable=True)
logo = sa.Column(st.LargeBinary(), nullable=True)
owner_id = sa.Column(sa.String(36), nullable=False)
ui_definition = sa.Column(sa.Text)
supplier_logo = sa.Column(sa.LargeBinary, nullable=True)

View File

@ -17,11 +17,5 @@ from sqlalchemy.dialects import mysql
CONF = cfg.CONF
def _is_mysql_avail():
return CONF.database.connection.startswith('mysql')
def LargeBinary():
if _is_mysql_avail():
return mysql.LONGBLOB
return sa.LargeBinary
return sa.LargeBinary().with_variant(mysql.LONGBLOB(), 'mysql')