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

Introduce truncate method #35

Merged
merged 4 commits into from
Jan 10, 2025
Merged

Introduce truncate method #35

merged 4 commits into from
Jan 10, 2025

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?

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.

3 participants