I want to achieve following functionality:
Whenever user tries to insert new data, i want to remove all old data from my custom table and insert new data.
For this, i want to use truncateTable() method. i am using code from below link:
But i am getting below error when i run code:
Something went wrong while saving this configuration: User Error: DDL statements are not allowed in transaction
Is there anyway we can truncate table using code?
Note: It works with delete but reason to use truncate is to reset my custom table's auto-increment key.