From a580e1759d150c10c2606a0c94dcfa972b3ce157 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 11 Apr 2009 23:52:09 -0700 Subject: [PATCH] Fixed a bug in which placeholder next ids in the note_current table weren't getting reaped. --- model/reap.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/model/reap.sql b/model/reap.sql index b4594f2..51236ad 100644 --- a/model/reap.sql +++ b/model/reap.sql @@ -64,6 +64,15 @@ where note_current.revision < now() - interval '1 day' ); +delete from + note_current +where ( + notebook_id is null or notebook_id not in + ( select notebook_id from notebook_current ) +) +and + note_current.revision < now() - interval '1 day'; + -- Delete unused file next ids and files whose notebooks or notes no longer exist. delete from file