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.0019_request_library_folder

"""
This script creates a request.folder_id column which is a foreign
key to the library_folder table. This also adds a 'type' and 'layout' column
to the form_definition table.
"""
from __future__ import print_function

import logging

from sqlalchemy import (
    Column,
    ForeignKey,
    Integer,
    MetaData,
    Table
)

from galaxy.model.custom_types import (
    JSONType,
    TrimmedString
)
from galaxy.model.migrate.versions.util import (
    add_column,
)

log = logging.getLogger(__name__)
metadata = MetaData()


[docs]def upgrade(migrate_engine): print(__doc__) metadata.bind = migrate_engine metadata.reflect() # Create the folder_id column col = Column("folder_id", Integer, ForeignKey('library_folder.id'), index=True) add_column(col, 'request', metadata, index_name='ix_request_folder_id') # Create the type column in form_definition FormDefinition_table = Table("form_definition", metadata, autoload=True) col = Column("type", TrimmedString(255), index=True) add_column(col, FormDefinition_table, metadata, index_name='ix_form_definition_type') col = Column("layout", JSONType()) add_column(col, FormDefinition_table, metadata)
[docs]def downgrade(migrate_engine): pass