-- Copyright (C) 2026  Eduard Wisch  <data@data-it-solution.de>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.

-- Indexes for llx_bankimport_transaction

ALTER TABLE llx_bankimport_transaction ADD UNIQUE INDEX uk_bankimport_transaction_ref (ref, entity);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_entity (entity);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_iban (iban);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_date_trans (date_trans);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_name (name);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_amount (amount);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_status (status);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_fk_bank (fk_bank);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_fk_facture (fk_facture);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_fk_facture_fourn (fk_facture_fourn);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_fk_societe (fk_societe);
ALTER TABLE llx_bankimport_transaction ADD INDEX idx_bankimport_transaction_import_key (import_key);

-- Foreign keys (optional, depends on your setup)
-- ALTER TABLE llx_bankimport_transaction ADD CONSTRAINT fk_bankimport_transaction_fk_bank FOREIGN KEY (fk_bank) REFERENCES llx_bank(rowid);
-- ALTER TABLE llx_bankimport_transaction ADD CONSTRAINT fk_bankimport_transaction_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture(rowid);
-- ALTER TABLE llx_bankimport_transaction ADD CONSTRAINT fk_bankimport_transaction_fk_facture_fourn FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn(rowid);
-- ALTER TABLE llx_bankimport_transaction ADD CONSTRAINT fk_bankimport_transaction_fk_societe FOREIGN KEY (fk_societe) REFERENCES llx_societe(rowid);
