alembic fails on postgres for migrations/versions/3f76448bb6de_add_user_confirmed_column.py
See original GitHub issueHello,
This update fails on postgres, stating that there are null values in the table. The following diff fixes it:
diff --git a/migrations/versions/3f76448bb6de_add_user_confirmed_column.py b/migrations/versions/3f76448bb6de_add_user_confirmed_column.py
index d1b6d29..3383625 100644
--- a/migrations/versions/3f76448bb6de_add_user_confirmed_column.py
+++ b/migrations/versions/3f76448bb6de_add_user_confirmed_column.py
@@ -18,8 +18,10 @@ 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))
+ op.execute('UPDATE "user" SET confirmed=true')
+ op.alter_column('user', 'confirmed', nullable=False)
def downgrade():
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Alembic migration stuck with postgresql? - Stack Overflow
With a simple ps i can see the postres stuck on "create table waiting". There are any best practice? python · postgresql ·...
Read more >using "postgresql.ARRAY(Unicode())" breaks automigrations
when I have a model with ARRAY(TEXT), alembic incorrectly fails to expand TEXT to sa. ... new test is added in test_autogen_render.py ->...
Read more >Flask by Example – Setting up Postgres, SQLAlchemy, and ...
Let's create our first migration by running the migrate command. $ python manage.py db migrate INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
Read more >Schema migrations with Alembic, Python and PostgreSQL
In his latest Write Stuff article, Gigi Sayfan takes a dive into database migrations with an Alembic Tour-de-Force. Database schema migrations ...
Read more >Cookbook — Alembic 1.9.0 documentation
The env.py script is modified such that it looks for this Connection and makes use ... Using this object in a migration script,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This was version 13 on debian 11Regards,Bas van den HeuvelOp 25 mei 2022 23:49 schreef jbe-dw @.***>: Hello, Can you tell us which version of postgres is concerned ? Regards
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
No problem, yes please test it on others too
On 30-05-2022 17:41, jbe-dw wrote: