m181121_153329_create_bills_table.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Handles the creation of table `bills`.
  5. */
  6. class m181121_153329_create_bills_table extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function Up()
  12. {
  13. $this->createTable('bills', [
  14. 'id' => $this->primaryKey(11),
  15. 'user_id' => $this->integer(11),
  16. 'type' => $this->string(15),
  17. 'bid_id' => $this->integer(11),
  18. 'payed' => $this->integer(1)->Null(),
  19. 'auction_id' => $this->integer(11),
  20. ]);
  21. $this->createIndex('idx-bills-userid', 'bills', 'user_id', 0);
  22. $this->createIndex('idx-bills-type', 'bills', 'type', 0);
  23. $this->createIndex('idx-bills-bidid', 'bills', 'bid_id', 0);
  24. $this->createIndex('idx-bills-payed', 'bills', 'payed', 0);
  25. $this->createIndex('idx-bills-aucid', 'bills', 'auction_id', 0);
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function Down()
  31. {
  32. $this->dropIndex('idx-bills-userid','bills');
  33. $this->dropIndex('idx-bills-type','bills');
  34. $this->dropIndex('idx-bills-bidid','bills');
  35. $this->dropIndex('idx-bills-payed','bills');
  36. $this->dropIndex('idx-bills-aucid','bills');
  37. $this->dropTable('bills');
  38. }
  39. }