42e85ed5564d_conversation_columns_set_nullable.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """conversation columns set nullable
  2. Revision ID: 42e85ed5564d
  3. Revises: f9107f83abab
  4. Create Date: 2024-03-07 08:30:29.133614
  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 = '42e85ed5564d'
  11. down_revision = 'f9107f83abab'
  12. branch_labels = None
  13. depends_on = None
  14. def upgrade():
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. with op.batch_alter_table('conversations', schema=None) as batch_op:
  17. batch_op.alter_column('app_model_config_id',
  18. existing_type=postgresql.UUID(),
  19. nullable=True)
  20. batch_op.alter_column('model_provider',
  21. existing_type=sa.VARCHAR(length=255),
  22. nullable=True)
  23. batch_op.alter_column('model_id',
  24. existing_type=sa.VARCHAR(length=255),
  25. nullable=True)
  26. # ### end Alembic commands ###
  27. def downgrade():
  28. # ### commands auto generated by Alembic - please adjust! ###
  29. with op.batch_alter_table('conversations', schema=None) as batch_op:
  30. batch_op.alter_column('model_id',
  31. existing_type=sa.VARCHAR(length=255),
  32. nullable=False)
  33. batch_op.alter_column('model_provider',
  34. existing_type=sa.VARCHAR(length=255),
  35. nullable=False)
  36. batch_op.alter_column('app_model_config_id',
  37. existing_type=postgresql.UUID(),
  38. nullable=False)
  39. # ### end Alembic commands ###