m181206_153417_create_goods_index_table.php 808 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. /**
  5. * Handles the creation of table `{{%goods_index}}`.
  6. */
  7. class m181206_153417_create_goods_index_table extends Migration
  8. {
  9. public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
  10. /**
  11. * @inheritdoc
  12. */
  13. public function up()
  14. {
  15. $this->createTable('{{%goods_index}}', [
  16. 'id' => Schema::TYPE_PK,
  17. 'goods_id' => $this->integer(11)->notNull(),
  18. 'entity' => $this->string(80)->notNull(),
  19. 'entity_id' => $this->integer(11)->notNull(),
  20. 'attribute' => $this->string(20)->notNull()
  21. ], $this->tableOptions);
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function down()
  27. {
  28. $this->dropTable('{{%goods_index}}');
  29. }
  30. }