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.0030_history_slug_column
"""
Migration script to add column for a history slug.
"""
import logging
from sqlalchemy import (
Column,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import (
add_column,
add_index,
drop_column
)
log = logging.getLogger(__name__)
metadata = MetaData()
[docs]def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
History_table = Table("history", metadata, autoload=True)
c = Column("slug", TEXT)
add_column(c, History_table, metadata)
# Index needs to be added separately because MySQL cannot index a TEXT/BLOB
# column without specifying mysql_length
add_index('ix_history_slug', History_table, 'slug')
[docs]def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
drop_column('slug', 'history', metadata)