Added an option to enable compression on MySQL tables (disabled by default)

This commit is contained in:
dvanaken 2019-10-23 17:41:10 -04:00 committed by Dana Van Aken
parent ec896d01f6
commit 40024b4d3c
2 changed files with 19 additions and 2 deletions

View File

@ -4,6 +4,8 @@ import logging
from django.db import migrations, ProgrammingError
from website.settings import MYSQL_COMPRESSION
LOG = logging.getLogger(__name__)
TABLES_TO_COMPRESS = [
@ -70,6 +72,14 @@ class Migration(migrations.Migration):
('website', '0001_initial'),
]
operations = [migrations.RunPython(enable_compression, disable_compression)]
if MYSQL_COMPRESSION:
operations = [
migrations.RunPython(enable_compression,
disable_compression)
]
else:
operations = [
migrations.RunSQL(migrations.RunSQL.noop,
migrations.RunSQL.noop),
]

View File

@ -34,6 +34,13 @@ DATABASES = {
}
}
# Enables compression on MySQL >= 5.6 on tables:
# - website_backupdata
# - website_knobdata
# - website_metricdata
# - website_pipelinedata
MYSQL_COMPRESSION = False
# ==============================================
# DEBUG CONFIGURATION
# ==============================================