'Add system versioning for a relative time period in MariaDB
I want to add system versioning for a table, "person." I want it to only store data that has changed in the past week.
Here's the best I can come up with...
ALTER TABLE person
ADD PERIOD FOR SYSTEM_TIME(ONE_WEEK_AGO, PRESENT),
ADD SYSTEM VERSIONING;
I am grateful for any pointers you all might have.
Solution 1:[1]
I have a fix, which I think will work (pending access). It is to run this as an event...
SET @oneMonthAgo = CURDATE() - INTERVAL 30 DAY;
DELETE HISTORY FROM person BEFORE SYSTEM_TIME @oneMonthAgo;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Paul Albert |
