<?php

use think\migration\Migrator;

class CreateSysMenuAbilityPermission 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_menu_ability_permission', ['id' => false, 'engine' => 'InnoDB', 'comment' => '菜单能力权限表']);
        $table->addColumn('menu_id', 'integer', ['null' => false, 'comment' => '菜单ID'])
            ->addColumn('ability_name', 'string', ['limit' => 64, 'null' => false, 'comment' => '能力名称'])
            ->addColumn('permission', 'string', ['limit' => 128, 'null' => false, 'comment' => '权限标志'])
            ->addColumn('sort', 'integer', ['limit' => 11, 'null' => false, 'default' => 0, 'comment' => '排序'])
            ->create();
    }
}
