It seems strange that I have to manually execute SQL to use the TRUNCATE command. Is there something bad about it that DHH is protecting me against?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using
TRUNCATEon some databases does not run triggers. UsingDELETEfor each row will still run triggers.TRUNCATEalso cannot be rolled back, so if you did a.destroy_allin a transaction, it would erase all the data even if you tried to rollback.So, yes, you are being protected against the effects of truncate.