00-folders.sql 684 B

12345678910111213141516
  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. -- folders map folder IDs as used by Syncthing to database folder indexes
  7. CREATE TABLE IF NOT EXISTS folders (
  8. idx INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  9. folder_id TEXT NOT NULL UNIQUE COLLATE BINARY,
  10. database_name TEXT COLLATE BINARY -- initially null
  11. ) STRICT
  12. ;
  13. -- The database_name is unique, when set
  14. CREATE INDEX IF NOT EXISTS folders_database_name ON folders (database_name) WHERE database_name IS NOT NULL
  15. ;