How can it be done after you set the expiration time of the record, it will be automatically deleted. After you set a specific duration older than 1 year or 6 months or 15 days it will automatically delete the record. What do I need?
I would not use commands, because you simply run it once a day, and dont delete records immediately.
This may cause issues, such as displaying old records of that same day, and processing them, if system is using these records to do something afterwards. Even statistics of these records would not be accurate all the time.
I would personally use jobs, and schedule them to run at the time record expires. This way record will be deleted at the same time they expire.
2
Answers
This is how I would do
Create a command
Run a command every 1 day
I would not use commands, because you simply run it once a day, and dont delete records immediately.
This may cause issues, such as displaying old records of that same day, and processing them, if system is using these records to do something afterwards. Even statistics of these records would not be accurate all the time.
I would personally use jobs, and schedule them to run at the time record expires. This way record will be deleted at the same time they expire.