fix(chatwoot): corrige erro de duplicação na importação de contatos by RaFaeL-Cunha · Pull Request #2203 · EvolutionAPI/evolution-api · GitHub
Skip to content

fix(chatwoot): corrige erro de duplicação na importação de contatos#2203

Merged
DavidsonGomes merged 1 commit intoEvolutionAPI:developfrom
RaFaeL-Cunha:patch-1
Nov 11, 2025
Merged

fix(chatwoot): corrige erro de duplicação na importação de contatos#2203
DavidsonGomes merged 1 commit intoEvolutionAPI:developfrom
RaFaeL-Cunha:patch-1

Conversation

@RaFaeL-Cunha
Copy link
Copy Markdown
Contributor

@RaFaeL-Cunha RaFaeL-Cunha commented Nov 9, 2025

Resolve o erro 'ON CONFLICT DO UPDATE command cannot affect row a second time' que ocorria ao importar histórico de contatos duplicados.

A correção remove a tentativa de atualizar o campo 'identifier' no ON CONFLICT, já que este campo faz parte da constraint de conflito e não pode ser atualizado.

Erro original:

  • identifier = EXCLUDED.identifier

Correção:

  • updated_at = NOW()

Isso permite que contatos duplicados sejam atualizados corretamente sem causar erro.

✅ Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have manually tested my changes thoroughly
  • I have verified the changes work with different scenarios
  • Any dependent changes have been merged and published

📝 Additional Notes

Minimal change (1 line) that fixes a critical bug. Low risk - only affects duplicate contact handling during import.

Summary by Sourcery

Fix duplicate contact import error in Chatwoot integration by adjusting the ON CONFLICT update clause to update only the timestamp.

Bug Fixes:

  • Remove identifier update in ON CONFLICT clause to avoid updating the same unique column twice
  • Update the updated_at field instead of identifier to resolve 'ON CONFLICT DO UPDATE command cannot affect row a second time' error during contact import

Resolve o erro 'ON CONFLICT DO UPDATE command cannot affect row a second time' que ocorria ao importar histórico de contatos duplicados.

A correção remove a tentativa de atualizar o campo 'identifier' no ON CONFLICT, já que este campo faz parte da constraint de conflito e não pode ser atualizado.

Erro original:
- identifier = EXCLUDED.identifier

Correção:
- updated_at = NOW()

Isso permite que contatos duplicados sejam atualizados corretamente sem causar erro.
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@DavidsonGomes DavidsonGomes merged commit 90640b7 into EvolutionAPI:develop Nov 11, 2025
5 checks passed
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.

2 participants