[FIX] account_payment_pro: idempotent pre-migrate#1009
Open
rov-adhoc wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Este PR corrige el script pre-migrate de account_payment_pro (19.0.2.0.0) para que sea idempotente y pueda recuperarse automáticamente tras ejecuciones parciales, evitando fallos por columnas ya renombradas/creadas.
Changes:
- Detecta explícitamente si existen las columnas vieja (
counterpart_exchange_rate) y nueva (counterpart_rate) para decidir entre renombrar, copiar+eliminar, o saltar. - Maneja el escenario de re-ejecución tras interrupción (ambas columnas presentes) para completar la migración sin intervención manual.
39da7e9 to
7b13f60
Compare
The 19.0.2.0.0 migration script failed when re-executed after a partial interruption, because it tried to rename counterpart_exchange_rate to counterpart_rate when the latter already existed when migrating from a version to another. Now handles all cases idempotently: - If old exists and new doesn't: rename (normal migration) - If both exist: copy data and drop old (recovery from partial run) - If only new exists: already migrated, skip - If neither exists: new install, ORM will create This allows the upgrade to automatically recover from partial failures without manual database intervention. Resolved error: psycopg2.errors.DuplicateColumn: column "counterpart_rate" of relation "account_payment" already exists
7b13f60 to
0c5b900
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The 19.0.2.0.0 migration script failed when re-executed after a partial interruption, because it tried to rename counterpart_exchange_rate to counterpart_rate when the latter already existed when migrating from a version to another.
Now handles all cases idempotently:
This allows the upgrade to automatically recover from partial failures without manual database intervention.
Resolved error:
psycopg2.errors.DuplicateColumn: column "counterpart_rate" of relation
"account_payment" already exists