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.0023_page_published_and_deleted_columns

"""
Migration script to add columns for tracking whether pages are deleted and
publicly accessible.
"""

import logging

from sqlalchemy import Boolean, Column, MetaData, Table

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


[docs]def upgrade(migrate_engine): metadata.bind = migrate_engine print(__doc__) metadata.reflect() Page_table = Table("page", metadata, autoload=True) c = Column("published", Boolean, index=True, default=False) c.create(Page_table, index_name='ix_page_published') assert c is Page_table.c.published c = Column("deleted", Boolean, index=True, default=False) c.create(Page_table, index_name='ix_page_deleted') assert c is Page_table.c.deleted
[docs]def downgrade(migrate_engine): metadata.bind = migrate_engine metadata.reflect() Page_table = Table("page", metadata, autoload=True) Page_table.c.published.drop() Page_table.c.deleted.drop()