"""Add email column to user table Revision ID: 27b841f29edb Revises: Create Date: 2025-04-24 18:14:20.471072 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '27b841f29edb' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('toot', schema=None) as batch_op: batch_op.alter_column('message', existing_type=sa.VARCHAR(length=512), type_=sa.String(length=255), existing_nullable=False) batch_op.alter_column('toot_time', existing_type=sa.VARCHAR(length=8), type_=sa.String(length=5), existing_nullable=False) batch_op.alter_column('day', existing_type=sa.VARCHAR(length=10), type_=sa.String(length=9), existing_nullable=False) with op.batch_alter_table('user', schema=None) as batch_op: batch_op.add_column(sa.Column('email', sa.String(length=120), nullable=False)) batch_op.add_column(sa.Column('password', sa.String(length=200), nullable=False)) batch_op.alter_column('id', existing_type=sa.VARCHAR(length=36), type_=sa.Integer(), existing_nullable=False, autoincrement=True) batch_op.alter_column('username', existing_type=sa.VARCHAR(length=80), type_=sa.String(length=100), existing_nullable=False) batch_op.create_unique_constraint(None, ['email']) batch_op.drop_column('password_hash') # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('user', schema=None) as batch_op: batch_op.add_column(sa.Column('password_hash', sa.VARCHAR(length=128), autoincrement=False, nullable=False)) batch_op.drop_constraint(None, type_='unique') batch_op.alter_column('username', existing_type=sa.String(length=100), type_=sa.VARCHAR(length=80), existing_nullable=False) batch_op.alter_column('id', existing_type=sa.Integer(), type_=sa.VARCHAR(length=36), existing_nullable=False, autoincrement=True) batch_op.drop_column('password') batch_op.drop_column('email') with op.batch_alter_table('toot', schema=None) as batch_op: batch_op.alter_column('day', existing_type=sa.String(length=9), type_=sa.VARCHAR(length=10), existing_nullable=False) batch_op.alter_column('toot_time', existing_type=sa.String(length=5), type_=sa.VARCHAR(length=8), existing_nullable=False) batch_op.alter_column('message', existing_type=sa.String(length=255), type_=sa.VARCHAR(length=512), existing_nullable=False) # ### end Alembic commands ###