I am adding a facility for clearing out a database so it’s empty ready for another year of data. I want to create a backup of that data before I delete it all but I can’t see how to achieve this in Wappler. Would I need to do some custom SQL or is there a Wappler way?
In the title you mean you want to duplicate a table, is that what you mean?
You’d need to use a custom SQL query:
CREATE TABLE new_table SELECT * FROM original_table;
To erase you can use a Database Delete step. The other way would be using a custom query “TRUNCATE”, but that also resets auto-increment IDs, not sure if that’s a good-idea tbh
Thanks @Apple. That’s the route I was going but wanted to check Wappler didn’t already have a similar feature.
I want the new table to be named with a datetimestamp so have used Set Value to create a variable and then have a parameter in the custom query but it doesn’t like it.
How can I set the table name to be like this? tablename_202207251344 (YearMonthDayHourMin) for example?