Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SQL/SQLite/schema_optimize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- This is done here as it is faster to do in sql than in the server.
--

DELETE FROM scanned_pics;
--DELETE FROM scanned_pics; ### Removed temporarily for debugging
Comment thread
darrell-k marked this conversation as resolved.
Outdated

-- XXX This appears to not be needed anymore as contributors are properly
-- removed by the new scanner
Expand Down
18 changes: 15 additions & 3 deletions SQL/SQLite/schema_scanner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ CREATE INDEX scannedUrlIndex ON scanned_files (url);

DROP TABLE IF EXISTS scanned_pics;
CREATE TABLE scanned_pics (
url text NOT NULL,
folder text,
full_path text NOT NULL,
timestamp int(10),
filesize int(10)
filesize int(10),
coverid char(8),
status char(1) CHECK (status IN ('D', 'E', 'N'))
-- D = image deleted (ie used in the database (tracks.cover) but no longer existing on disk)
-- E = an existing image present in tracks.cover
-- N = a new image (eg on disk but not used in tracks.cover - might actually have been on disk before, but passed over in a previous scan)
-- NULL = we'll set status 'E' to NULL if after n&c music files have been processed the image is still being used.
-- This improves performance as we'll only process the tracks if there's also a N(ew) image
);
CREATE INDEX scannedPicUrlIndex ON scanned_pics (url);
CREATE INDEX scannedPicUrlIndex ON scanned_pics (full_path);
CREATE INDEX scannedPicDirIndex ON scanned_pics (folder);
create index scannedPicStatusidx on scanned_pics(status);
Comment thread
darrell-k marked this conversation as resolved.
Outdated

CREATE INDEX IF NOT EXISTS trackscoveridx ON tracks(cover);
Comment thread
darrell-k marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion SQL/mysql/schema_optimize.sql
Comment thread
darrell-k marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- This is done here as it is faster to do in sql than in the server.
--

DELETE FROM scanned_pics;
--DELETE FROM scanned_pics; ### Removed temporarily for debugging

-- XXX This appears to not be needed anymore as contributors are properly
-- removed by the new scanner
Expand Down
18 changes: 15 additions & 3 deletions SQL/mysql/schema_scanner.sql
Comment thread
darrell-k marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ CREATE INDEX scannedUrlIndex ON scanned_files (url);

DROP TABLE IF EXISTS scanned_pics;
CREATE TABLE scanned_pics (
url text NOT NULL COLLATE NOCASE, -- URL must be case insensitive, or we might duplicate tracks if the filename changes case only (https://github.com/LMS-Community/slimserver/issues/705#issuecomment-1026229542)
folder text,
full_path text NOT NULL,
timestamp int(10),
filesize int(10)
filesize int(10),
coverid char(8),
status char(1) CHECK (status IN ('D', 'E', 'N'))
-- D = image deleted (ie used in the database (tracks.cover) but no longer existing on disk)
-- E = an existing image present in tracks.cover
-- N = a new image (eg on disk but not used in tracks.cover - might actually have been on disk before, but passed over in a previous scan)
-- NULL = we'll set status 'E' to NULL if after n&c music files have been processed the image is still being used.
-- This improves performance as we'll only process the tracks if there's also a N(ew) image
);
CREATE INDEX scannedPicUrlIndex ON scanned_pics (url);
CREATE INDEX scannedPicUrlIndex ON scanned_pics (full_path);
CREATE INDEX scannedPicDirIndex ON scanned_pics (folder);
create index scannedPicStatusidx on scanned_pics(status);

CREATE INDEX IF NOT EXISTS trackscoveridx ON tracks(cover);
Loading