Skip to content

Fixes issue #879 #1456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged

Fixes issue #879 #1456

merged 1 commit into from
May 16, 2025

Conversation

thiagoomatheus
Copy link
Contributor

@thiagoomatheus thiagoomatheus commented May 16, 2025

Erro ao enviar arquivo com o mesmo nome através da opção DOCUMENTO, pelo whatsapp WEB (PT)

Error when sending a file with the same name via the DOCUMENT option, via WhatsApp WEB (EN)

Quando o usuário envia duas vezes ou mais um arquivo com o mesmo nome, através da opção DOCUMENTO, através do WHATSAPP WEB, está dando erro. Percebi que existe uma chave unica no banco de dados com o nome do arquivo. (PT)

When the user sends a file with the same name twice or more, through the DOCUMENT option, through WHATSAPP WEB, an error is being thrown. I noticed that there is a unique key in the database with the file name. (EN)

The original code in model Media schema includes a "@unique" atribute in fileName field. This atribute don't allow the user to save multiple files with same name resulting in error reported in issue #879.

This update allow the user to receive multiples files with same name.

The code remove "@unique" atribute on fileName field and includes the migration.

Summary by Sourcery

Remove the unique constraint on the fileName field in the Media model to resolve errors when uploading files with duplicate names via WhatsApp Web.

Bug Fixes:

  • Allow multiple files with the same name to be saved by removing the unique constraint on the fileName field in the Media model.

Build:

  • Add a database migration to drop the unique index on the Media fileName field.

Copy link
Contributor

sourcery-ai bot commented May 16, 2025

Reviewer's Guide

This pull request removes the unique constraint on the fileName field in the Media model to allow multiple files with the same name to be uploaded and stored, addressing errors encountered when uploading duplicate-named files via WhatsApp Web. The change is implemented by updating the Prisma schema and adding a database migration to drop the unique index.

File-Level Changes

Change Details Files
Removed unique constraint from fileName in Media model to allow duplicate file names.
  • Deleted the @unique attribute from the fileName field in the Prisma schema for both MySQL and PostgreSQL.
prisma/mysql-schema.prisma
prisma/postgresql-schema.prisma
Added a database migration to drop the unique index on fileName in the Media table.
  • Created a new migration SQL file to drop the Media_fileName_key index in PostgreSQL.
prisma/postgresql-migrations/20250516012152_remove_unique_atribute_for_file_name_in_media/migration.sql

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@DavidsonGomes DavidsonGomes changed the base branch from main to develop May 16, 2025 15:16
@DavidsonGomes DavidsonGomes merged commit 7cccda1 into EvolutionAPI:develop May 16, 2025
1 check 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