1 from sqlalchemy
import *
3 import migrate
.changeset
5 from sqlalchemy
.ext
.declarative
import declarative_base
6 TableBase
= declarative_base()
9 class Forum(TableBase
):
10 __tablename__
= 'forums'
11 id = Column(Integer
, primary_key
=True, autoincrement
=True, nullable
=False)
12 name
= Column(Unicode(133), nullable
=False)
13 access_level
= Column(Enum(u
'normal', u
'soapbox', u
'archive', name
='forums_access_level'), nullable
=False, server_default
=u
'normal')
16 def upgrade(migrate_engine
):
17 TableBase
.metadata
.bind
= migrate_engine
19 Forum
.__table__
.c
.access_level
.type.create(bind
=migrate_engine
)
20 Forum
.__table__
.c
.access_level
.create()
22 def downgrade(migrate_engine
):
23 TableBase
.metadata
.bind
= migrate_engine
24 access_level_type
= Forum
.__table__
.c
.access_level
.type
26 Forum
.__table__
.c
.access_level
.drop()
27 access_level_type
.drop(bind
=migrate_engine
)