Browse Source

修改数据表antgoods_attribute的type字段,设置字段默认值

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
4403ab16e1
  1. 28
      vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php

28
vendor/antgoods/goods/src/migrations/m191121_111825_update_column_type_in_table_antgoods_attribute.php

@ -0,0 +1,28 @@
<?php
use yii\db\Migration;
/**
* Class m191121_111825_update_column_type_in_table_antgoods_attribute
*/
class m191121_111825_update_column_type_in_table_antgoods_attribute extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$this->dropColumn('antgoods_attribute', 'type');
$this->addColumn('antgoods_attribute', 'type', $this->smallInteger(2)->notNull()->defaultValue(1)->comment('类型:1:商品sku属性'));
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropColumn('antgoods_attribute', 'type');
$this->addColumn('antgoods_attribute', 'type', $this->smallInteger(2)->defaultValue(null)->comment('类型'));
return true;
}
}
Loading…
Cancel
Save