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

  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m191111_102925_create_table_cart
  5. */
  6. class m191111_102925_create_table_cart 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('ats_cart', [
  15. 'id' => $this->primaryKey(),
  16. 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
  17. 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
  18. 'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'),
  19. 'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'),
  20. 'goods_price'=>$this->integer(20)->defaultValue(null)->comment('商品售价'),
  21. 'sku_id'=>$this->integer(11)->defaultValue(null)->comment('商品sku的id'),
  22. 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
  23. 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
  24. 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
  25. ],$tableOptions);
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function down()
  31. {
  32. $this->dropTable('ats_cart');
  33. return true;
  34. }
  35. }