<?php

use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;
use think\migration\db\Column;

class CreatePriceAdjustCate extends Migrator
{
    public function change(): void {
        $table = $this->table('price_adjust_cate', [
            'engine'    => 'InnoDB',
            'collation' => 'utf8mb4_general_ci',
            'comment'   => '调价申请类型字典表',
        ]);

        $table
            ->addColumn('type', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 0, 'comment' => '类型:1客户交易场景,2卡BIN'])
            ->addColumn('title', 'string', ['limit' => 100, 'null' => false, 'default' => '', 'comment' => '名称'])
            ->addColumn('value', 'integer', ['null' => false, 'default' => 0, 'comment' => '业务值（同type内唯一，申请单存此值）'])
            ->addColumn('is_other', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 0, 'comment' => '是否为其他选项:1是(选中后需填备注)'])
            ->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
            ->addColumn('status', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '状态:0禁用,1启用'])
            ->addColumn('create_time', 'biginteger', ['null' => false, 'default' => 0, 'comment' => '创建时间'])
            ->addColumn('delete_time', 'biginteger', ['null' => false, 'default' => 0, 'comment' => '删除时间'])
            ->create();
    }
}