7d55a089b5bc_.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:tasking-manager 作者: hotosm 项目源码 文件源码
def upgrade():
    conn = op.get_bind()

    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('projects', sa.Column('task_creation_mode', sa.Integer(), nullable=True))
    op.create_index('idx_geometry', 'projects', ['geometry'], unique=False, postgresql_using='gist')
    op.add_column('tasks', sa.Column('extra_properties', sa.Unicode(), nullable=True))

    for project in conn.execute(projects.select()):
        zooms = conn.execute(
            sa.sql.expression.select([tasks.c.zoom]).distinct(tasks.c.zoom)
                .where(tasks.c.project_id == project.id))
        zooms = zooms.fetchall()

        if len(zooms) == 1 and zooms[0] == (None,):
            op.execute(
                projects.update().where(projects.c.id == project.id)
                    .values(task_creation_mode=1))
    # ### end Alembic commands ###
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号