04c602f5dc9b_update_appmodelconfig_and_add_table_.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """update AppModelConfig and add table TracingAppConfig
  2. Revision ID: 04c602f5dc9b
  3. Revises: 4e99a8df00ff
  4. Create Date: 2024-06-12 07:49:07.666510
  5. """
  6. import sqlalchemy as sa
  7. from alembic import op
  8. import models as models
  9. # revision identifiers, used by Alembic.
  10. revision = '04c602f5dc9b'
  11. down_revision = '4ff534e1eb11'
  12. branch_labels = None
  13. depends_on = None
  14. def upgrade():
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('tracing_app_configs',
  17. sa.Column('id', models.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
  18. sa.Column('app_id', models.StringUUID(), nullable=False),
  19. sa.Column('tracing_provider', sa.String(length=255), nullable=True),
  20. sa.Column('tracing_config', sa.JSON(), nullable=True),
  21. sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
  22. sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
  23. sa.PrimaryKeyConstraint('id', name='tracing_app_config_pkey')
  24. )
  25. with op.batch_alter_table('tracing_app_configs', schema=None) as batch_op:
  26. batch_op.create_index('tracing_app_config_app_id_idx', ['app_id'], unique=False)
  27. # ### end Alembic commands ###
  28. def downgrade():
  29. # ### commands auto generated by Alembic - please adjust! ##
  30. with op.batch_alter_table('tracing_app_configs', schema=None) as batch_op:
  31. batch_op.drop_index('tracing_app_config_app_id_idx')
  32. op.drop_table('tracing_app_configs')
  33. # ### end Alembic commands ###