root/galaxy-central/lib/galaxy/model/migrate/versions/0034_page_user_share_association.py

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

import galaxy-central

行番号 
1"""
2Migration script to create a table for page-user share association.
3"""
4
5from sqlalchemy import *
6from sqlalchemy.orm import *
7from migrate import *
8from migrate.changeset import *
9
10import logging
11log = logging.getLogger( __name__ )
12
13metadata = MetaData( migrate_engine )
14db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) )
15
16PageUserShareAssociation_table = Table( "page_user_share_association", metadata,
17    Column( "id", Integer, primary_key=True ),
18    Column( "page_id", Integer, ForeignKey( "page.id" ), index=True ),
19    Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True )
20    )
21   
22def upgrade():
23    print __doc__
24    metadata.reflect()
25
26    # Create stored_workflow_tag_association table.
27    try:
28        PageUserShareAssociation_table.create()
29    except Exception, e:
30        print str(e)
31        log.debug( "Creating page_user_share_association table failed: %s" % str( e ) )
32       
33def downgrade():
34    metadata.reflect()
35       
36    # Drop workflow_tag_association table.
37    try:
38        PageUserShareAssociation_table.drop()
39    except Exception, e:
40        print str(e)
41        log.debug( "Dropping page_user_share_association table failed: %s" % str( e ) )
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。