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

Allow TRUNCATE for MySQL #1010

Conversation

ping-localhost
Copy link

Resolves issue #864 which originates from #656.


I agree that proper isolation is a must, but my database forces safe updates, which the current DELETE-query does not adhere to. To resolve that, I've added a simple switch to choose between DELETE and TRUNCATE.

Not sure if this is the best solution (we could also wrap the DELETE with SET SQL_SAFE_UPDATES), so feel free to edit/comment/etc.

@coveralls
Copy link

coveralls commented Dec 13, 2023

Coverage Status

coverage: 59.281% (+0.06%) from 59.226%
when pulling 55c859d on ping-localhost:added-safe-update-to-mysql-driver
into a5dc5d1 on golang-migrate:master.

@ping-localhost
Copy link
Author

CI lint failure is not due to my changes, but because master itself is not compliant.

@ping-localhost ping-localhost force-pushed the added-safe-update-to-mysql-driver branch from 839d678 to 19c8682 Compare January 18, 2024 07:31
@ping-localhost ping-localhost force-pushed the added-safe-update-to-mysql-driver branch from 19c8682 to 55c859d Compare January 18, 2024 07:39
@emeka
Copy link

emeka commented Apr 10, 2024

Could this be solved by adding a LIMIT clause to the delete instead of moving back to truncate which is not transactional?

@ping-localhost
Copy link
Author

Closing this in favor of #1070

@ping-localhost ping-localhost deleted the added-safe-update-to-mysql-driver branch April 15, 2024 08:43
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.

None yet

3 participants