This document is for an old release 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.0180_add_vault_table

import datetime

from sqlalchemy import Column, DateTime, ForeignKey, MetaData, Table, Text

now = datetime.datetime.utcnow
meta = MetaData()

vault = Table(
    'vault', meta,
    Column('key', Text, primary_key=True),
    Column('parent_key', Text, ForeignKey('vault.key'), index=True, nullable=True),
    Column('value', Text, nullable=True),
    Column("create_time", DateTime, default=now),
    Column("update_time", DateTime, default=now, onupdate=now)

[docs]def upgrade(migrate_engine): meta.bind = migrate_engine vault.create()
[docs]def downgrade(migrate_engine): meta.bind = migrate_engine # This revision is not part of 21.09, but in 22.01 it will be handled by Alembic. # It is possible to reach a state (via upgrading/downgrading) where this table # will have been dropped by Alembic, but SQLAlchemy Migrate (our previous # db migrations tool) will have version 180 (which includes this table). # Downgrading from such a state would raise an error - which this code prevents. try: vault.drop() except Exception: pass