fix typo in sql

This commit is contained in:
Hongbo Wu
2024-06-12 19:41:07 +08:00
parent 71d07caf94
commit 30adbb735f

View File

@ -5,7 +5,7 @@
BEGIN;
CREATE OR REPLACE PROCEDURE omnivore.batch_delete_trash_items()
RETURNS VOID AS $$
LANGUAGE plpgsql AS $$
DECLARE
user_record RECORD;
user_cursor CURSOR FOR
@ -17,20 +17,21 @@ DECLARE
status = 'ACTIVE';
BEGIN
FOR user_record IN user_cursor LOOP
BEGIN;
BEGIN
-- For Row Level Security
PERFORM omnivore.set_claims(user_record.id, 'omnivore_user');
-- For Row Level Security
PERFORM omnivore.set_claims(user_record.id, 'omnivore_user');
DELETE FROM omnivore.library_item
WHERE
user_id = user_record.id
AND state = 'DELETED'
AND deleted_at < NOW() - INTERVAL '14 days';
DELETE FROM omnivore.library_item
WHERE
user_id = user_record.id
AND state = 'DELETED'
AND deleted_at < NOW() - INTERVAL '14 days';
COMMIT;
COMMIT;
END;
END LOOP;
END;
$$ LANGUAGE plpgsql;
END
$$;
COMMIT;