Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

m220817_074240_add_foreign_keys_documents.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m220817_074240_add_foreign_keys_documents
  5. */
  6. class m220817_074240_add_foreign_keys_documents extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. $this->createIndex('user_fk', 'delivery_note', ['id_user']);
  14. $this->createIndex('producer_fk', 'delivery_note', ['id_producer']);
  15. $this->createIndex('user_fk', 'quotation', ['id_user']);
  16. $this->createIndex('producer_fk', 'quotation', ['id_producer']);
  17. $this->createIndex('user_fk', 'invoice', ['id_user']);
  18. $this->createIndex('producer_fk', 'invoice', ['id_producer']);
  19. $this->createIndex('delivery_note_fk', 'order', ['id_delivery_note']);
  20. $this->createIndex('quotation_fk', 'order', ['id_quotation']);
  21. $this->createIndex('invoice_fk', 'order', ['id_invoice']);
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function safeDown()
  27. {
  28. $this->dropIndex('user_fk', 'delivery_note');
  29. $this->dropIndex('producer_fk', 'delivery_note');
  30. $this->dropIndex('user_fk', 'quotation');
  31. $this->dropIndex('producer_fk', 'quotation');
  32. $this->dropIndex('user_fk', 'invoice');
  33. $this->dropIndex('producer_fk', 'invoice');
  34. $this->dropIndex('delivery_note_fk', 'order');
  35. $this->dropIndex('quotation_fk', 'order');
  36. $this->dropIndex('invoice_fk', 'order');
  37. }
  38. }