Fixed log messages in migration 0002

This commit is contained in:
Dana Van Aken 2019-08-27 04:28:12 -04:00
parent 149942e6b8
commit e28c979912
1 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,6 @@ class Migration(migrations.Migration):
] ]
try: try:
LOG.info('***** VENDOR: %s', connection.vendor)
if connection.vendor == 'mysql': if connection.vendor == 'mysql':
version = (0, 0, 0) version = (0, 0, 0)
@ -31,10 +30,9 @@ class Migration(migrations.Migration):
cursor.execute('SELECT VERSION()') cursor.execute('SELECT VERSION()')
version = cursor.fetchone()[0] version = cursor.fetchone()[0]
version = version.split('-')[0] version_str = version.split('-')[0]
version = version.split('.') version = version_str.split('.')
version = tuple(int(v) for v in version) version = tuple(int(v) for v in version)
LOG.info('***** DB VERSION: %s', version)
if version >= (5, 7, 0): if version >= (5, 7, 0):
operations = [ operations = [
@ -44,14 +42,15 @@ class Migration(migrations.Migration):
"OPTIMIZE TABLE " + table_name + ";"]) "OPTIMIZE TABLE " + table_name + ";"])
for table_name in TABLES_TO_COMPRESS for table_name in TABLES_TO_COMPRESS
] ]
LOG.info('***** DONE ENABLING COMPRESSION') LOG.debug("Enabled compression for '%s %s'", connection.vendor, version_str)
else: else:
operations = [] operations = []
LOG.info('***** COMPRESSION NOT SUPPORTED: %s < (5, 7, 0)', version) LOG.debug("Disabled compression for '%s %s': version not supported",
connection.vendor, version_str)
else: else:
LOG.info('***** DB COMPRESSION NOT SUPPORTED: %s', connection.vendor) LOG.debug("Disabled compression for '%s': vendor not supported", connection.vendor)
except ProgrammingError as err: except ProgrammingError as err:
LOG.warning("Error applying migration '0002_enable_compression'... Skipping") LOG.warning("Error applying migration '0002_enable_compression'... Skipping")