Skip to content

[FIX] account_payment_pro: idempotent pre-migrate#1009

Open
rov-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-115083-rov
Open

[FIX] account_payment_pro: idempotent pre-migrate#1009
rov-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-115083-rov

Conversation

@rov-adhoc

Copy link
Copy Markdown
Contributor

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

Copilot AI review requested due to automatic review settings April 13, 2026 14:00
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread account_payment_pro/migrations/19.0.2.0.0/pre-migrate.py Outdated
Comment thread account_payment_pro/migrations/19.0.2.0.0/pre-migrate.py Outdated
@rov-adhoc rov-adhoc force-pushed the 19.0-h-115083-rov branch 4 times, most recently from 39da7e9 to 7b13f60 Compare April 16, 2026 19:35
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants