[Python] How to use `alembic upgrade head` while requesting DB commit in between each file?

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    Using Alembic updating an ENUM TYPE I found myself blocked because the datamigration didn't want to use the enum new values without a commit in between files.

    I tried to force the commit in the migration with no luck. And I finally ran alembic twice in order to fix it.

    (alembic upgrade +1 && alembic upgrade head) || exit 0


    Which is not to my liking.

    ChatGPT suggest to use a flag that doesn't exist but would be exactly what I'm looking for.

    alembic upgrade --commit head


    Do you know how I can run alembic upgrade head while ensuring that commits are made between each migration file?

    Refs New enum values must be committed before they can be used

    Continue reading...

Compartilhe esta Página