Skip to content

Commit

Permalink
Update 2_4_15.sql
Browse files Browse the repository at this point in the history
Aggiunta indice per idintervento in co_righe_documenti
  • Loading branch information
lucasalva87 committed May 2, 2020
1 parent 0db3ef4 commit 8706efd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions update/2_4_15.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM (`in_interventi` INNER
INSERT INTO `zz_views` (`id_module`, `name`, `query`, `order`, `search`, `format`, `default`, `visible`) VALUES
((SELECT `id` FROM `zz_modules` WHERE `name` = 'Interventi'), 'Rif. fattura', 'fattura.info', 17, 1, 0, 0, 1);

-- Aggiunta indice per idintervento in co_righe_documenti
ALTER TABLE `co_righe_documenti` ADD INDEX(`idintervento`);

-- Ore preavviso rinnovo con decimali per frazioni ore
ALTER TABLE `co_contratti` CHANGE `ore_preavviso_rinnovo` `ore_preavviso_rinnovo` DECIMAL(15,6) NULL DEFAULT NULL;

Expand Down

4 comments on commit 8706efd

@Dasc3er
Copy link
Contributor

@Dasc3er Dasc3er commented on 8706efd May 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perché aggiungere un indice, e proprio appena prima della release?

@loviuz
Copy link
Contributor

@loviuz loviuz commented on 8706efd May 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E' collegato al commit 15d27d4 che introduce una nuova colonna nelle attività, il riferimento al numero di fattura, però dopo molte ottimizzazioni la vista rimaneva molto lenta. Indicizzando l'id intervento nelle righe fatture la vista torna molto veloce. Non abbiamo aggiunto altri indici, ad esempio su idcontratto, idpreventivo, ecc perché per il momento non ci sono viste che lo necessitino. @lucasalva87 dovreva forse specificare meglio nel commento del commit il motivo dell'aggiunta indice

@Dasc3er
Copy link
Contributor

@Dasc3er Dasc3er commented on 8706efd May 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In questo caso poteva essere sensato inserire la foreign key relativa, che dovrebbe prevedere in automatico l'aggiunta di un indice?
Infatti mi chiedevo perché proprio per gli interventi e non per il resto.

@loviuz
Copy link
Contributor

@loviuz loviuz commented on 8706efd May 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sarebbe corretto anche la foreign key, è vero. Senza il "ON DELETE CASCADE" però, perché se elimino un intervento fatturato non devo modificare le righe di fatture già emesse

Please sign in to comment.