PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/galaxy/model/migrate/versions/0039_add_synopsis_column_to_library_table.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 26 lines | 17 code | 6 blank | 3 comment | 0 complexity | 6915ea3fca370fb3cdd529653e30665e MD5 | raw file
 1"""
 2Migration script to add a synopsis column to the library table.
 3"""
 4
 5from sqlalchemy import *
 6from migrate import *
 7from migrate.changeset import *
 8
 9import logging
10log = logging.getLogger( __name__ )
11
12metadata = MetaData()
13
14def upgrade(migrate_engine):
15    metadata.bind = migrate_engine
16    print __doc__
17    metadata.reflect()
18
19    Library_table = Table( "library", metadata, autoload=True )
20    c = Column( "synopsis", TEXT )
21    c.create( Library_table )
22    assert c is Library_table.c.synopsis
23
24def downgrade(migrate_engine):
25    metadata.bind = migrate_engine
26    pass