Merge "Fix LargeBinary column type for mysql"

This commit is contained in:
Jenkins 2017-06-19 15:43:44 +00:00 committed by Gerrit Code Review
commit bf0b201af6
2 changed files with 9 additions and 2 deletions

View File

@ -27,6 +27,7 @@ down_revision = '002'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
MYSQL_ENGINE = 'InnoDB'
MYSQL_CHARSET = 'utf8'
@ -36,7 +37,13 @@ def upgrade():
op.create_table(
'glare_blob_data',
sa.Column('id', sa.String(255), primary_key=True, nullable=False),
sa.Column('data', sa.LargeBinary(), nullable=False),
# Because of strange behavior of mysql LargeBinary is converted to
# BLOB instead of LONGBLOB. So we have to fix it explicitly with
# 'with_variant' call.
sa.Column(
'data',
sa.LargeBinary().with_variant(mysql.LONGBLOB(), 'mysql'),
nullable=False),
sa.PrimaryKeyConstraint('id'),
mysql_engine=MYSQL_ENGINE,
mysql_charset=MYSQL_CHARSET

View File

@ -252,7 +252,7 @@ class ArtifactBlobData(BASE, ArtifactBase):
__table_args__ = (
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
id = Column(String(255), primary_key=True, nullable=False)
data = Column(LargeBinary, nullable=False)
data = Column(LargeBinary(length=(2 ** 32) - 1), nullable=False)
def register_models(engine):