<?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();
    }
}
