-- Indexy pro casto filtrovane sloupce
-- Spustit rucne: mysql -u root app < migrations/001_add_indexes.sql

-- Dochazka - filtrovani dle uzivatele a data smeny
CREATE INDEX idx_attendance_user_date ON attendance(user_id, shift_date);

-- Vydane faktury - filtrovani dle statusu a data vystaveni (KPI karty, seznamy)
CREATE INDEX idx_invoices_status_issue ON invoices(status, issue_date);

-- Vydane faktury - detekce po splatnosti
CREATE INDEX idx_invoices_due_date ON invoices(due_date);

-- Nabidky - razeni a vyhledavani dle cisla
CREATE INDEX idx_quotations_number ON quotations(quotation_number);

-- Refresh tokeny - cleanup a validace dle uzivatele a expirace
CREATE INDEX idx_refresh_tokens_user_exp ON refresh_tokens(user_id, expires_at);

-- Audit log - razeni a mazani starych zaznamu
CREATE INDEX idx_audit_log_created ON audit_log(created_at);
