refactor: 修改产品属性类型

This commit is contained in:
2025-02-12 17:58:53 +08:00
parent feb0b92bd0
commit f20325b220
6 changed files with 19 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;
class CreateProductAttr extends Migrator
@@ -29,6 +30,7 @@ class CreateProductAttr extends Migrator
{
$table = $this->table('product_attr', ['engine' => 'InnoDB', 'comment' => '商品属性表']);
$table->addColumn('language_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '语言ID'])
->addColumn('attr_type', MysqlAdapter::INT_TINY, ['limit' => 3, 'null' => false, 'default' => 2, 'comment' => '类型:1为选项类型2为文本输入类型'])
->addColumn('attr_name', 'string', ['limit' => 64, 'signed' => false, 'null' => false, 'comment' => '属性ID'])
->addColumn('is_system', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否系统属性:1是,0否'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])

View File

@@ -1,6 +1,5 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;
class CreateProductAttrProp extends Migrator
@@ -30,7 +29,6 @@ class CreateProductAttrProp extends Migrator
{
$table = $this->table('product_attr_prop', ['id' => false, 'engine' => 'InnoDB', 'comment' => '商品属性特征表']);
$table->addColumn('attr_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '属性ID'])
->addColumn('prop_type', MysqlAdapter::INT_TINY, ['limit' => 3, 'null' => false, 'default' => 2, 'comment' => '类型:1为选项类型2为文本输入类型'])
->addColumn('prop_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '特征名'])
->addColumn('prop_value', 'string', ['limit' => 64, 'null' => false, 'comment' => '特征值'])
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '新增时间'])