question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

alembic fails on postgres for migrations/versions/3f76448bb6de_add_user_confirmed_column.py

See original GitHub issue

Hello,

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:open
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bvdheuvelcommented, May 25, 2022

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: @.***>

0reactions
bvdheuvelcommented, May 30, 2022

No problem, yes please test it on others too

On 30-05-2022 17:41, jbe-dw wrote:

Alright, it look ok. I’ll just give a try on other databases before.

Thanks Bas!

— Reply to this email directly, view it on GitHub https://github.com/PowerDNS-Admin/PowerDNS-Admin/issues/1210#issuecomment-1141292418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AENTYQBH43AZV6CYQH3SUC3VMTOULANCNFSM5W567G6Q. You are receiving this because you authored the thread.Message ID: @.***>

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found