Skip to content

Conversation

@dpanta94
Copy link
Member

@dpanta94 dpanta94 commented Jan 10, 2025

Introduces a truncate method that does what the empty_table was doing.

The reason is that TRUCNATE causes implicit commits - make it not suitable to be used during testing in most cases.

Now the method empty_table will simply delete everything from that table with the only difference not resseting the AUTO_INCREMENT if it exists. That should be ok.

Moreover it prevents multile "check" queries before deciding if we can or cant update the tables during the current request.

@dpanta94 dpanta94 marked this pull request as ready for review January 10, 2025 19:18
@dpanta94 dpanta94 self-assigned this Jan 10, 2025
@dpanta94 dpanta94 added the enhancement New feature or request label Jan 10, 2025
@dpanta94 dpanta94 requested review from borkweb and defunctl January 10, 2025 19:18
Copy link
Member

@borkweb borkweb left a comment

Choose a reason for hiding this comment

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

That's a really smart change!

@dpanta94 dpanta94 merged commit 979344c into main Jan 10, 2025
2 checks passed
@dpanta94 dpanta94 deleted the feat/introduce-truncate-method branch January 10, 2025 19:40
*
* @return int|false The number of removed rows, or `false` to indicate a failure.
*/
public function truncate() {
Copy link
Contributor

@defunctl defunctl Jan 10, 2025

Choose a reason for hiding this comment

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

If this is going to be a public method, shouldn't this be added to the Schema_Interface and do a major version release as this would be a breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

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

@defunctl i am not against that - i just didnt consider it necessary. Happy to follow what you think is best in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants