1 from sqlalchemy
import *
3 import migrate
.changeset
5 from sqlalchemy
.ext
.declarative
import declarative_base
6 TableBase
= declarative_base()
8 class Forum(TableBase
):
9 __tablename__
= 'forums'
10 id = Column(Integer
, primary_key
=True, autoincrement
=True, nullable
=False)
11 name
= Column(Unicode(133), nullable
=False)
12 description
= Column(Unicode(1024), nullable
=False, default
=u
'', server_default
=u
'')
13 access_level
= Column(Enum(u
'normal', u
'soapbox', u
'archive', name
='forums_access_level'), nullable
=False, default
=u
'normal', server_default
=u
'normal')
16 def upgrade(migrate_engine
):
17 TableBase
.metadata
.bind
= migrate_engine
19 # populate_default gets all retarded I don't even
20 Forum
.__table__
.c
.description
.create(populate_default
=False)
22 def downgrade(migrate_engine
):
23 TableBase
.metadata
.bind
= migrate_engine
25 Forum
.__table__
.c
.description
.drop()