Merge "Use MEDIUMBLOB column when storing fractals in MySQL"

This commit is contained in:
Jenkins 2015-09-21 07:26:46 +00:00 committed by Gerrit Code Review
commit 60be60cf9b
1 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,7 @@ from kombu.pools import producers
from oslo_config import cfg
from oslo_log import log
from PIL import Image
from sqlalchemy.dialects import mysql
from faafo import queues
from faafo import version
@ -81,7 +82,13 @@ class Fractal(db.Model):
xb = db.Column(db.Float, nullable=False)
ya = db.Column(db.Float, nullable=False)
yb = db.Column(db.Float, nullable=False)
image = db.Column(db.LargeBinary, nullable=True)
if CONF.database_url.startswith('mysql'):
LOG.debug('Using MySQL database backend')
image = db.Column(mysql.MEDIUMBLOB, nullable=True)
else:
image = db.Column(db.LargeBinary, nullable=True)
generated_by = db.Column(db.String(256), nullable=True)
def __repr__(self):