Skip to content
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

[10.x] Fix issue with table prefix duplication in DatabaseTruncation trait #48291

Merged

Conversation

mobidev86
Copy link
Contributor

This pull request addresses the issue documented in #48264
where the DatabaseTruncation trait would attempt to truncate a table with a prefix being applied twice when using a DB connection configured to prefix all tables.

Changes Made:

  • Added a new function removeTablePrefix to remove the table prefix from a table name if it exists.
  • Modified the truncateTablesForConnection method to utilize removeTablePrefix when checking for table existence and performing truncation.

Steps to Reproduce:

  • More details has been provided in the issue itself

Expected Outcome:

  • With this pull request, tests should pass successfully, and the issue with table prefix duplication should be resolved.

Additional Context:

  • This change ensures that the table prefix is correctly handled when checking for table existence and performing truncation, preventing the issue where the prefix was applied twice.

Testing:

  • I have tested this fix with the steps mentioned in the "Steps to Reproduce" section and confirmed that the tests now pass as expected.

@taylorotwell taylorotwell merged commit cdf9dba into laravel:10.x Sep 4, 2023
18 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