2019-12-21 14:43:03 +00:00
|
|
|
"""Add user.confirmed column
|
|
|
|
|
|
|
|
Revision ID: 3f76448bb6de
|
|
|
|
Revises: b0fea72a3f20
|
|
|
|
Create Date: 2019-12-21 17:11:36.564632
|
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = '3f76448bb6de'
|
|
|
|
down_revision = 'b0fea72a3f20'
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2019-12-21 15:26:56 +00:00
|
|
|
with op.batch_alter_table('user') as batch_op:
|
2019-12-22 01:40:05 +00:00
|
|
|
batch_op.add_column(
|
2023-03-05 10:01:17 +00:00
|
|
|
sa.Column('confirmed', sa.Boolean(), nullable=True,
|
2019-12-22 01:40:05 +00:00
|
|
|
default=False))
|
2023-03-05 10:01:17 +00:00
|
|
|
with op.batch_alter_table('user') as batch_op:
|
|
|
|
user = sa.sql.table('user', sa.sql.column('confirmed'))
|
|
|
|
batch_op.execute(user.update().values(confirmed=False))
|
2023-03-14 12:53:30 +00:00
|
|
|
batch_op.alter_column('confirmed', nullable=False, existing_type=sa.Boolean(), existing_nullable=True, existing_server_default=False)
|
2019-12-21 14:43:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2019-12-21 15:26:56 +00:00
|
|
|
with op.batch_alter_table('user') as batch_op:
|
|
|
|
batch_op.drop_column('confirmed')
|