1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
|
(conc "DELETE FROM runs WHERE state='deleted' and last_update < " keep-record-age ";")
;; delete empty runs
(conc "DELETE FROM runs WHERE id NOT IN (SELECT DISTINCT r.id FROM runs AS r INNER JOIN tests AS t ON t.run_id=r.id) and last_update < " keep-record-age ";")
;; remove orphaned test_rundat entries
(conc "DELETE FROM test_rundat where test_id NOT IN (SELECT id FROM tests) ;")
;;
(conc "DELETE FROM test_steps WHERE test_id NOT IN (SELECT id FROM tests) and last_update < " keep-record-age " ;")
))))
;; (db:delay-if-busy dbdat)
;(debug:print-info 0 *default-log-port* statements)
(sqlite3:with-transaction
db
(lambda ()
(sqlite3:for-each-row (lambda (tot)
|
>
>
>
|
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
|
(conc "DELETE FROM runs WHERE state='deleted' and last_update < " keep-record-age ";")
;; delete empty runs
(conc "DELETE FROM runs WHERE id NOT IN (SELECT DISTINCT r.id FROM runs AS r INNER JOIN tests AS t ON t.run_id=r.id) and last_update < " keep-record-age ";")
;; remove orphaned test_rundat entries
(conc "DELETE FROM test_rundat where test_id NOT IN (SELECT id FROM tests) ;")
;;
(conc "DELETE FROM test_steps WHERE test_id NOT IN (SELECT id FROM tests) and last_update < " keep-record-age " ;")
;; remove orphaned test_dat entries
(conc "DELETE FROM test_data WHERE test_id NOT IN (SELECT id FROM tests) and last_update < " keep-record-age " ;")
))))
;; (db:delay-if-busy dbdat)
;(debug:print-info 0 *default-log-port* statements)
(sqlite3:with-transaction
db
(lambda ()
(sqlite3:for-each-row (lambda (tot)
|