def upgrade(pyramid_env):
with context.begin_transaction():
op.drop_column('facebook_post', 'post_type')
op.drop_column('facebook_post', 'link_name')
# Could also alter column, but this operation has limitations
# (which we won't hit)
op.drop_column('facebook_post', 'attachment')
op.add_column('facebook_post', sa.Column('attachment_blob', sa.Binary))
op.add_column('facebook_source', sa.Column('lower_bound', sa.DateTime))
op.add_column('facebook_source', sa.Column('upper_bound', sa.DateTime))
# Do stuff with the app's models here.
from assembl import models as m
db = m.get_session_maker()()
with transaction.manager:
# Also correct the spelling mistake in attachment model.
a = m.Attachment.__table__
db.execute(
a.update().where(a.c.attachmentPurpose == op.inline_literal(
'EMBEEDED_ATTACHMENT')).
values(attachmentPurpose=op.inline_literal("EMBED_ATTACHMENT"))
)
e5d1484442b_facebook_attachment.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录