18 lines
784 B
SQL
18 lines
784 B
SQL
-- Add indexes for improved query performance
|
|
|
|
-- Favorites table indexes
|
|
CREATE INDEX IF NOT EXISTS idx_favorites_userid ON favorites(userid);
|
|
CREATE INDEX IF NOT EXISTS idx_favorites_path ON favorites(path);
|
|
|
|
-- Tags table indexes
|
|
CREATE INDEX IF NOT EXISTS idx_tags_name ON tags(name);
|
|
|
|
-- Tagged photos indexes
|
|
CREATE INDEX IF NOT EXISTS idx_tagged_photo_photo_name ON tagged_photo(photo_name);
|
|
CREATE INDEX IF NOT EXISTS idx_tagged_photo_tag_id ON tagged_photo(tag_id);
|
|
|
|
-- EXIF table indexes (date_taken already has index from previous migration)
|
|
-- Adding composite index for common EXIF queries
|
|
CREATE INDEX IF NOT EXISTS idx_image_exif_camera ON image_exif(camera_make, camera_model);
|
|
CREATE INDEX IF NOT EXISTS idx_image_exif_gps ON image_exif(gps_latitude, gps_longitude);
|