Browse Source

修改数据表antgoods_category的pid字段和icon字段

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
d314065047
  1. 26
      vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php
  2. 5
      vendor/antgoods/goods/src/models/ars/Category.php

26
vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php

@ -0,0 +1,26 @@
<?php
use yii\db\Migration;
/**
* Class m191125_084547_update_column_pid_and_icon_in_table_antgoods_category
*/
class m191125_084547_update_column_pid_and_icon_in_table_antgoods_category extends Migration
{
public function up()
{
$this->dropColumn('antgoods_category', 'icon');
$this->addColumn('antgoods_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标'));
$this->dropColumn('antgoods_category', 'pid');
$this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id'));
}
public function down()
{
$this->dropColumn('antgoods_category', 'icon');
$this->addColumn('antgoods_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标'));
$this->dropColumn('antgoods_category', 'pid');
$this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id'));
return true;
}
}

5
vendor/antgoods/goods/src/models/ars/Category.php

@ -13,7 +13,7 @@ use yii\behaviors\TimestampBehavior;
* @property int $pid 父级id
* @property int $goods_count 商品数量
* @property int $sort_order 排序
* @property string $icon 图标
* @property int $icon 图标
* @property int $is_show 是否显示,1为不显示
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
@ -50,9 +50,8 @@ class Category extends \yii\db\ActiveRecord
{
return [
[['name'], 'required'],
[['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete'], 'integer'],
[['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'],
[['name'], 'string', 'max' => 60],
[['icon'], 'string', 'max' => 64],
[['iconImageId'], 'string'],
];
}

Loading…
Cancel
Save