03-drop-bad-invalid.sql 581 B

1234567891011121314151617
  1. -- Copyright (C) 2025 The Syncthing Authors.
  2. --
  3. -- This Source Code Form is subject to the terms of the Mozilla Public
  4. -- License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. -- You can obtain one at https://mozilla.org/MPL/2.0/.
  6. -- Remove broken file entries in the database.
  7. DELETE FROM files
  8. WHERE type == 0 -- files
  9. AND NOT deleted -- that are not deleted
  10. AND blocklist_hash IS null -- with no blocks
  11. AND local_flags & {{.LocalInvalidFlags}} == 0 -- and not invalid
  12. ;
  13. -- Force a new index transmission.
  14. DELETE FROM indexids
  15. ;