246ba09cbbdb_add_app_anntation_setting.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. """add_app_anntation_setting
  2. Revision ID: 246ba09cbbdb
  3. Revises: 714aafe25d39
  4. Create Date: 2023-12-14 11:26:12.287264
  5. """
  6. import sqlalchemy as sa
  7. from alembic import op
  8. from sqlalchemy.dialects import postgresql
  9. # revision identifiers, used by Alembic.
  10. revision = '246ba09cbbdb'
  11. down_revision = '714aafe25d39'
  12. branch_labels = None
  13. depends_on = None
  14. def upgrade():
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('app_annotation_settings',
  17. sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
  18. sa.Column('app_id', postgresql.UUID(), nullable=False),
  19. sa.Column('score_threshold', sa.Float(), server_default=sa.text('0'), nullable=False),
  20. sa.Column('collection_binding_id', postgresql.UUID(), nullable=False),
  21. sa.Column('created_user_id', postgresql.UUID(), nullable=False),
  22. sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
  23. sa.Column('updated_user_id', postgresql.UUID(), nullable=False),
  24. sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
  25. sa.PrimaryKeyConstraint('id', name='app_annotation_settings_pkey')
  26. )
  27. with op.batch_alter_table('app_annotation_settings', schema=None) as batch_op:
  28. batch_op.create_index('app_annotation_settings_app_idx', ['app_id'], unique=False)
  29. with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
  30. batch_op.drop_column('annotation_reply')
  31. # ### end Alembic commands ###
  32. def downgrade():
  33. # ### commands auto generated by Alembic - please adjust! ###
  34. with op.batch_alter_table('app_model_configs', schema=None) as batch_op:
  35. batch_op.add_column(sa.Column('annotation_reply', sa.TEXT(), autoincrement=False, nullable=True))
  36. with op.batch_alter_table('app_annotation_settings', schema=None) as batch_op:
  37. batch_op.drop_index('app_annotation_settings_app_idx')
  38. op.drop_table('app_annotation_settings')
  39. # ### end Alembic commands ###