mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
34 lines
2.0 KiB
PHP
34 lines
2.0 KiB
PHP
<?php
|
||
|
||
use think\migration\Migrator;
|
||
|
||
class SystemMcpKey extends Migrator
|
||
{
|
||
/**
|
||
* MCP密钥表.
|
||
*
|
||
* 明文密钥永不出现在本表:
|
||
* - key 存 SHA-256 哈希(char 64,唯一索引)
|
||
* - key_prefix 存明文前 16 位(char 16,展示用)
|
||
*/
|
||
public function change()
|
||
{
|
||
$table = $this->table('system_mcp_key')
|
||
->setComment('MCP密钥表')
|
||
->addColumn('title', 'char', ['limit' => 50, 'null' => true, 'comment' => '密钥名称'])
|
||
->addColumn('key', 'char', ['limit' => 64, 'null' => true, 'comment' => '密钥SHA-256哈希'])
|
||
->addColumn('key_prefix', 'char', ['limit' => 16, 'null' => true, 'default' => '', 'comment' => '密钥前缀(展示用)'])
|
||
->addColumn('bind_admin_id', 'biginteger', ['limit' => 11, 'null' => true, 'signed' => false, 'comment' => '绑定创建者ID'])
|
||
->addColumn('status', 'integer', ['limit' => 11, 'null' => true, 'default' => 1, 'comment' => '状态 {radio} (0:禁用,1:启用)'])
|
||
->addColumn('remark', 'char', ['limit' => 255, 'null' => true, 'default' => '', 'comment' => ''])
|
||
->addColumn('use_num', 'biginteger', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '调用次数'])
|
||
->addColumn('last_use_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '最后使用时间'])
|
||
->addColumn('create_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '创建时间'])
|
||
->addColumn('update_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '更新时间'])
|
||
->addColumn('delete_time', 'integer', ['limit' => 11, 'null' => true, 'default' => 0, 'signed' => false, 'comment' => '删除时间'])
|
||
->addIndex(['key'], ['unique' => true, 'name' => 'key'])
|
||
->addIndex(['delete_time'], ['name' => 'delete_time'])
|
||
->create();
|
||
}
|
||
}
|