Parcourir la source

[Backend] Documents : ralentissement page index #288

refactoring
Guillaume Bourgeois il y a 2 ans
Parent
révision
9f1cb99557
1 fichiers modifiés avec 47 ajouts et 0 suppressions
  1. +47
    -0
      console/migrations/m220817_074240_add_foreign_keys_documents.php

+ 47
- 0
console/migrations/m220817_074240_add_foreign_keys_documents.php Voir le fichier

@@ -0,0 +1,47 @@
<?php

use yii\db\Migration;

/**
* Class m220817_074240_add_foreign_keys_documents
*/
class m220817_074240_add_foreign_keys_documents extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createIndex('user_fk', 'delivery_note', ['id_user']);
$this->createIndex('producer_fk', 'delivery_note', ['id_producer']);

$this->createIndex('user_fk', 'quotation', ['id_user']);
$this->createIndex('producer_fk', 'quotation', ['id_producer']);

$this->createIndex('user_fk', 'invoice', ['id_user']);
$this->createIndex('producer_fk', 'invoice', ['id_producer']);

$this->createIndex('delivery_note_fk', 'order', ['id_delivery_note']);
$this->createIndex('quotation_fk', 'order', ['id_quotation']);
$this->createIndex('invoice_fk', 'order', ['id_invoice']);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropIndex('user_fk', 'delivery_note');
$this->dropIndex('producer_fk', 'delivery_note');

$this->dropIndex('user_fk', 'quotation');
$this->dropIndex('producer_fk', 'quotation');

$this->dropIndex('user_fk', 'invoice');
$this->dropIndex('producer_fk', 'invoice');

$this->dropIndex('delivery_note_fk', 'order');
$this->dropIndex('quotation_fk', 'order');
$this->dropIndex('invoice_fk', 'order');
}
}

Chargement…
Annuler
Enregistrer