def upgrade():
classification_type_enum = postgresql.ENUM('binary', 'multi-label', 'multi-class', name='classification_type_enum')
classification_type_enum.create(op.get_bind())
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('problem', sa.Column('classification_type', sa.Enum('binary', 'multi-label', 'multi-class', name='classification_type_enum'), server_default='binary', nullable=True))
op.execute('''
UPDATE "problem" SET classification_type = 'multi-class' WHERE (SELECT COUNT(*) FROM "problem_label" WHERE problem_id = problem.id) >= 2
''')
# ### end Alembic commands ###
d616b0a80feb_add_classification_type.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录