You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m191119_022939_create_table_attribute
  5. */
  6. class m191119_022939_create_table_attribute extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function up()
  12. {
  13. $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="属性表"';
  14. $this->createTable('antgoods_attribute', [
  15. 'id' => $this->primaryKey(),
  16. 'name'=>$this->string(50)->notNull()->comment('属性名'),
  17. 'value'=>$this->text()->notNull()->comment('属性值'),
  18. 'type'=>$this->smallInteger(2)->defaultValue(null)->comment('类型'),
  19. 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'),
  20. 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
  21. 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
  22. 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
  23. ],$tableOptions);
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function down()
  29. {
  30. $this->dropTable('antgoods_attribute');
  31. return true;
  32. }
  33. }