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.0039_add_synopsis_column_to_library_table
"""
Migration script to add a synopsis column to the library table.
"""
import logging
from sqlalchemy import (
Column,
MetaData,
Table,
TEXT
)
log = logging.getLogger(__name__)
metadata = MetaData()
[docs]def upgrade(migrate_engine):
print(__doc__)
metadata.bind = migrate_engine
metadata.reflect()
try:
Library_table = Table("library", metadata, autoload=True)
c = Column("synopsis", TEXT)
c.create(Library_table)
assert c is Library_table.c.synopsis
except Exception:
log.exception("Adding column 'synopsis' to 'library' table failed.")
[docs]def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
try:
Library_table = Table("library", metadata, autoload=True)
Library_table.c.synopsis.drop()
except Exception:
log.exception("Dropping column 'synopsis' from 'library' table failed")