0

I've created a mysql table to hold some records (id, timestamp, fname..etc). The main goal is to hold this info for 1 year and then archive it. I have no experience with triggers but I'm wondering is it possible to use the timestamp in a trigger so that a year from the timestamp it gets moved to an archive table?

user2692751
  • 91
  • 1
  • 4

1 Answers1

0

As per the documentation:

A trigger is defined to activate when a statement inserts, updates, or deletes rows in the associated table. These row operations are trigger events.

Time passed isn't one of those trigger events.

You have to create a process to do that job for you.

See this answer for some approaches to do that.

Community
  • 1
  • 1
Filipe Silva
  • 21,189
  • 5
  • 53
  • 68