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