123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- use yii\db\Migration;
- use yii\db\Schema;
- /**
- * Handles the creation of table `{{%goods_sku}}`.
- */
- class m181111_123134_create_goods_sku_table extends Migration
- {
- public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
- /**
- * @inheritdoc
- */
- public function up()
- {
- $this->createTable('{{%goods_sku}}', [
- 'id' => Schema::TYPE_PK,
- 'goods_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '商品ID'",
- 'name' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '规格名称'",
- 'origin_price' => Schema::TYPE_DECIMAL . "(10,2) NOT NULL COMMENT '原价'",
- 'price' => Schema::TYPE_DECIMAL . "(10,2) NOT NULL COMMENT '售价'",
- 'stock' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '库存'",
- 'actual_sales' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '实际销量'",
- 'virtual_sales' => Schema::TYPE_INTEGER . "(11) 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_sku}}');
- }
- }
|