root/galaxy-central/lib/galaxy/model/migrate/versions/0023_page_published_and_deleted_columns.py

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

import galaxy-central

行番号 
1"""
2Migration script to add columns for tracking whether pages are deleted and
3publicly accessible.
4"""
5
6from sqlalchemy import *
7from migrate import *
8from migrate.changeset import *
9
10import logging
11log = logging.getLogger( __name__ )
12
13metadata = MetaData( migrate_engine )
14
15def upgrade():
16   
17    print __doc__
18    metadata.reflect()
19   
20    Page_table = Table( "page", metadata, autoload=True )
21   
22    c = Column( "published", Boolean, index=True, default=False )
23    c.create( Page_table )
24    assert c is Page_table.c.published
25   
26    c = Column( "deleted", Boolean, index=True, default=False )
27    c.create( Page_table )
28    assert c is Page_table.c.deleted
29
30def downgrade():
31    metadata.reflect()
32
33    Page_table = Table( "page", metadata, autoload=True )
34    Page_table.c.published.drop()
35    Page_table.c.deleted.drop()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。