Added an option to enable compression on MySQL tables (disabled by default)
This commit is contained in:
parent
ec896d01f6
commit
40024b4d3c
|
@ -4,6 +4,8 @@ import logging
|
||||||
|
|
||||||
from django.db import migrations, ProgrammingError
|
from django.db import migrations, ProgrammingError
|
||||||
|
|
||||||
|
from website.settings import MYSQL_COMPRESSION
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
TABLES_TO_COMPRESS = [
|
TABLES_TO_COMPRESS = [
|
||||||
|
@ -70,6 +72,14 @@ class Migration(migrations.Migration):
|
||||||
('website', '0001_initial'),
|
('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),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
|
@ -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
|
# DEBUG CONFIGURATION
|
||||||
# ==============================================
|
# ==============================================
|
||||||
|
|
Loading…
Reference in New Issue