Answer the question
In order to leave comments, you need to log in
How to make automatic deletion of old records?
There are two questions. I have coupons in the database. They have a date and time. How to automatically delete coupons that are older than the current date? To keep the base clean.
And another question. Is it possible to set up auto-increment in the database? Let's say there were 15 coupons and they were numbered from 1 to 15. I deleted the last 4 pcs. But when creating a new coupon, he was assigned the number 16. And not the number 12.
Answer the question
In order to leave comments, you need to log in
Good morning.
1) By cron run a console script that will clear the database from old entries.
2) No.
The correct solution would not be to edit autoincrement, but to create a separate field in the table for serial numbering of coupons. Or even easier, use in the gridview, for example, SerialColumn
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question