root/galaxy-central/lib/galaxy/model/migrate/versions/0056_workflow_outputs.py

リビジョン 2, 1.1 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1"""
2Migration script to create tables for adding explicit workflow outputs.
3"""
4
5from sqlalchemy import *
6from sqlalchemy.orm import *
7from migrate import *
8from migrate.changeset import *
9
10import logging
11logging.basicConfig( level=logging.DEBUG )
12log = logging.getLogger( __name__ )
13
14# Need our custom types, but don't import anything else from model
15from galaxy.model.custom_types import *
16
17metadata = MetaData( migrate_engine )
18db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) )
19
20WorkflowOutput_table = Table( "workflow_output", metadata,
21    Column( "id", Integer, primary_key=True ),
22    Column( "workflow_step_id", Integer, ForeignKey("workflow_step.id"), index=True, nullable=False),
23    Column( "output_name", String(255), nullable=True))
24
25tables = [WorkflowOutput_table]
26
27def upgrade():
28    print __doc__
29    metadata.reflect()
30    for table in tables:
31        try:
32            table.create()
33        except:
34            log.warn( "Failed to create table '%s', ignoring (might result in wrong schema)" % table.name )
35
36def downgrade():
37    metadata.reflect()
38    for table in tables:
39        table.drop()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。