refactor: banner新增相关分类数据字段

This commit is contained in:
2025-04-23 15:24:06 +08:00
parent d5b55b9782
commit 5f15a3f21b
5 changed files with 167 additions and 12 deletions

View File

@@ -0,0 +1,37 @@
<?php
use think\migration\Migrator;
class CreateSysBannerProdCateMapping extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('sys_banner_prod_cate_mapping', ['id' => false, 'engine' => 'InnoDB', 'comment' => 'banner与产品分类关联表']);
$table->addColumn('banner_item_id', 'integer', ['limit' => 11, 'null' => false, 'signed' => false, 'comment' => '横幅项id'])
->addColumn('product_category_id', 'integer', ['limit' => 11, 'null' => false,'signed' => false, 'comment' => '产品分类id'])
->addIndex(['banner_item_id'], ['unique' => false])
->addIndex(['product_category_id'], ['unique' => false])
->create();
}
}