Hello,
i have installed traccar 3.9 + webui on a 2012 microsoft windows server.
i have created a batch file that run1 sql script to delete old entries older than 2 months.
My batch execute "mysql -uroot -pmypassword traccar < C:\wamp64\bin\mysql\mysql5.7.14\bin\purge2months.sql
The purge2months.sql contains :
alter table events DROP FOREIGN KEY events_fkey_position_id;
alter table events ADD CONSTRAINT events_fkey_position_id FOREIGN KEY (position_id) REFERENCES positions (id) ON DELETE CASCADE;
UPDATE devices SET latestPosition_id = NULL WHERE latestPosition_id IN (SELECT id FROM positions WHERE time < DATE_ADD(NOW(), INTERVAL -2 MONTH));
DELETE FROM events WHERE time < DATE_ADD(NOW(), INTERVAL -2 MONTH);
DELETE FROM positions WHERE time < DATE_ADD(NOW(), INTERVAL -2 MONTH);
Hello, i have installed traccar 3.9 + webui on a 2012 microsoft windows server. i have created a batch file that run1 sql script to delete old entries older than 2 months. My batch execute "mysql -uroot -pmypassword traccar < C:\wamp64\bin\mysql\mysql5.7.14\bin\purge2months.sql
The purge2months.sql contains : alter table events DROP FOREIGN KEY
events_fkey_position_id
; alter table events ADD CONSTRAINTevents_fkey_position_id
FOREIGN KEY (position_id
) REFERENCESpositions
(id
) ON DELETE CASCADE; UPDATE devices SET latestPosition_id = NULL WHERE latestPosition_id IN (SELECT id FROM positions WHERE time < DATE_ADD(NOW(), INTERVAL -2 MONTH)); DELETE FROM events WHERE time < DATE_ADD(NOW(), INTERVAL -2 MONTH); DELETE FROM positions WHERE time < DATE_ADD(NOW(), INTERVAL -2 MONTH);Do you think my "purge2months.sql" is ok?