"""set otp as integer Revision ID: d994081ed483 Revises: 1387db583e1d Create Date: 2020-09-25 07:11:21.603504 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "d994081ed483" down_revision = "1387db583e1d" branch_labels = None depends_on = None def upgrade(): with op.batch_alter_table("users") as batch_op: batch_op.alter_column( column_name="otp", existing_type=sa.String(length=255), type_=sa.Integer, ) query = "SELECT CAST(otp AS INTEGER) from users" op.execute(query) def downgrade(): pass