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.0066_deferred_job_and_transfer_job_tables
"""
Migration script to create table for storing deferred job and managed transfer
information.
"""
from __future__ import print_function
import datetime
import logging
from sqlalchemy import Column, DateTime, Integer, MetaData, String, Table
from galaxy.model.custom_types import JSONType
now = datetime.datetime.utcnow
log = logging.getLogger(__name__)
metadata = MetaData()
# Table to add
DeferredJob_table = Table("deferred_job", metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("state", String(64), index=True),
Column("plugin", String(128), index=True),
Column("params", JSONType))
TransferJob_table = Table("transfer_job", metadata,
Column("id", Integer, primary_key=True),
Column("create_time", DateTime, default=now),
Column("update_time", DateTime, default=now, onupdate=now),
Column("state", String(64), index=True),
Column("path", String(1024)),
Column("params", JSONType))
[docs]def upgrade(migrate_engine):
metadata.bind = migrate_engine
print(__doc__)
metadata.reflect()
# Create deferred_job table
try:
DeferredJob_table.create()
except Exception:
log.exception("Creating deferred_job table failed.")
# Create transfer_job table
try:
TransferJob_table.create()
except Exception:
log.exception("Creating transfer_job table failed.")
[docs]def downgrade(migrate_engine):
metadata.bind = migrate_engine
metadata.reflect()
# Drop deferred_job table
try:
DeferredJob_table.drop()
except Exception:
log.exception("Dropping deferred_job table failed.")
# Drop transfer_job table
try:
TransferJob_table.drop()
except Exception:
log.exception("Dropping transfer_job table failed.")