123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- use yii\db\Migration;
- use yii\db\Schema;
- /**
- * Handles the creation of table `{{%goods_attr}}`.
- */
- class m181111_130147_create_goods_attr_table extends Migration
- {
- public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
- /**
- * @inheritdoc
- */
- public function up()
- {
- $this->createTable('{{%goods_attr}}', [
- 'id' => Schema::TYPE_PK,
- 'goods_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '商品ID'",
- 'name' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '属性名称'",
- /**
- * 2018年12月2日23:11修改value字段
- */
- 'value' => Schema::TYPE_STRING . "(100) NOT NULL COMMENT '属性值'",
- 'created_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
- 'updated_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
- 'status' => Schema::TYPE_SMALLINT . "(1) NOT NULL DEFAULT '1' COMMENT '状态'",
- ]);
- }
- /**
- * @inheritdoc
- */
- public function down()
- {
- $this->dropTable('{{%goods_attr}}');
- }
- }
|