From fcda4977e2007e95a246bdf2a456263c39074201 Mon Sep 17 00:00:00 2001 From: Stefan Ubbink Date: Sun, 5 Mar 2023 11:01:17 +0100 Subject: [PATCH] Fix migration issue #635 as proposed by @keesbos --- .../versions/3f76448bb6de_add_user_confirmed_column.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migrations/versions/3f76448bb6de_add_user_confirmed_column.py b/migrations/versions/3f76448bb6de_add_user_confirmed_column.py index d1b6d29..490aebe 100644 --- a/migrations/versions/3f76448bb6de_add_user_confirmed_column.py +++ b/migrations/versions/3f76448bb6de_add_user_confirmed_column.py @@ -18,8 +18,12 @@ depends_on = None def upgrade(): with op.batch_alter_table('user') as batch_op: batch_op.add_column( - sa.Column('confirmed', sa.Boolean(), nullable=False, + sa.Column('confirmed', sa.Boolean(), nullable=True, default=False)) + 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)) + batch_op.alter_column('confirmed', nullable=False) def downgrade():