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.
38 lines
1.3 KiB
38 lines
1.3 KiB
<?php
|
|
|
|
use yii\db\Migration;
|
|
|
|
/**
|
|
* Class m191111_102925_create_table_cart
|
|
*/
|
|
class m191111_102925_create_table_cart extends Migration
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function up()
|
|
{
|
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="购物车表"';
|
|
$this->createTable('ats_cart', [
|
|
'id' => $this->primaryKey(),
|
|
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
|
|
'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
|
|
'goods_name'=>$this->string(120)->notNull()->comment('商品名称'),
|
|
'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'),
|
|
'goods_price'=>$this->integer(20)->defaultValue(null)->comment('商品售价'),
|
|
'sku_id'=>$this->integer(11)->notNull()->comment('商品sku的id'),
|
|
'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
|
|
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
|
|
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
|
|
],$tableOptions);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function down()
|
|
{
|
|
$this->dropTable('ats_cart');
|
|
return true;
|
|
}
|
|
}
|