You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
Do you think my "purge2months.sql" is ok?
The text was updated successfully, but these errors were encountered:
onetic
changed the title
backup and delete old entries with a .bat file (wamp Mysql+windows)
Delete old entries with a .bat file (wamp Mysql+windows)
Sep 25, 2018
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
) 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?
The text was updated successfully, but these errors were encountered: