-- ABOUTME: Migration to create tag_suggestions table. -- ABOUTME: Tracks tag usage for autocomplete in the UI. -- Tag suggestions for autocomplete -- Updated synchronously during tagging operations CREATE TABLE tag_suggestions ( tag TEXT PRIMARY KEY, total_assignments INTEGER NOT NULL DEFAULT 0, active_animals INTEGER NOT NULL DEFAULT 0, last_used_utc INTEGER, updated_at_utc INTEGER NOT NULL ); -- Index for sorting by popularity CREATE INDEX idx_tag_suggestions_popularity ON tag_suggestions(active_animals DESC, total_assignments DESC);