Bladeren bron

[Backend] Documents : ralentissement page index #288

refactoring
Guillaume Bourgeois 2 jaren geleden
bovenliggende
commit
9f1cb99557
1 gewijzigde bestanden met toevoegingen van 47 en 0 verwijderingen
  1. +47
    -0
      console/migrations/m220817_074240_add_foreign_keys_documents.php

+ 47
- 0
console/migrations/m220817_074240_add_foreign_keys_documents.php Bestand weergeven

@@ -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');
}
}

Laden…
Annuleren
Opslaan