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

FIX Truncate table to clear table #11309

Merged

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Jul 19, 2024

Issue silverstripe/.github#278

For whatever reason MySQL 8 specifically would end up with an auto increment value of 2 instead of 1 which caused behat tests that rely on an ID to fail e.g. https://github.com/silverstripe/silverstripe-elemental/actions/runs/9986875108/job/27600180632?pr=1219

Truncating the table will correctly reset the auto increment

recipe-sink ci run with pr - https://github.com/creative-commoners/recipe-kitchen-sink/actions/runs/10005707377

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

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

Weird that the code here intended to resolve this wasn't resolving it - but even weirder we weren't already truncating. LGTM.

@GuySartorelli GuySartorelli merged commit 4693e3f into silverstripe:5.2 Jul 21, 2024
16 checks passed
@GuySartorelli GuySartorelli deleted the pulls/5.2/clear-table branch July 21, 2024 21:03
@robbieaverill
Copy link
Contributor

robbieaverill commented Jul 23, 2024

It's possible that it was like this because truncating tables can fail if there are foreign key constraints in place, whereas deleting doesn't.

Background context here: #8437

Edit: you could remove this method overload entirely as it's now the same as the parent class

@emteknetnz
Copy link
Member Author

emteknetnz commented Jul 23, 2024

Gah .. yeah Sam wasn't kidding about the performance difference when running phpunit

Before
image

After :(
image

Have raised issue to revert and reimplement - #11311

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