Warning
This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Source code for galaxy.model.migrate.versions.0122_grow_mysql_blobs
"""
Migration script to grow MySQL blobs.
"""
from __future__ import print_function
import logging
from sqlalchemy import MetaData
log = logging.getLogger(__name__)
metadata = MetaData()
BLOB_COLUMNS = [
("deferred_job", "params"),
("extended_metadata", "data"),
("form_definition", "fields"),
("form_definition", "layout"),
("form_values", "content"),
("history_dataset_association", "metadata"),
("job", "destination_params"),
("library_dataset_dataset_association", "metadata"),
("post_job_action", "action_arguments"),
("request", "notification"),
("sample", "workflow"),
("transfer_job", "params"),
("workflow_step", "tool_inputs"),
("workflow_step", "tool_errors"),
("workflow_step", "position"),
("workflow_step", "config"),
("tool_shed_repository", "metadata"),
("tool_shed_repository", "tool_shed_status"),
]
[docs]def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
if migrate_engine.name != "mysql":
return
for (table, column) in BLOB_COLUMNS:
cmd = "ALTER TABLE %s MODIFY COLUMN %s MEDIUMBLOB;" % (table, column)
try:
migrate_engine.execute(cmd)
except Exception:
log.exception("Failed to grow column %s.%s", table, column)