feat: 新增操作日志表迁移文件
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Migrator;
|
||||||
|
|
||||||
|
class CreateSysOperateLog 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_operate_log', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '操作日志表']);
|
||||||
|
$table->addColumn('user_id', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '用户ID'])
|
||||||
|
->addColumn('title', 'string', ['limit' => 50, 'default' => '', 'comment' => '标题'])
|
||||||
|
->addColumn('controller', 'string', ['limit' => 50, 'default' => '', 'comment' => '控制器'])
|
||||||
|
->addColumn('action', 'string', ['limit' => 50, 'default' => '', 'comment' => '方法'])
|
||||||
|
->addColumn('url', 'string', ['limit' => 255, 'default' => '', 'comment' => 'URL'])
|
||||||
|
->addColumn('ip', 'string', ['limit' => 50, 'default' => '', 'comment' => 'IP'])
|
||||||
|
->addColumn('method', 'string', ['limit' => 10, 'default' => '', 'comment' => '请求方式'])
|
||||||
|
->addColumn('params', 'text', ['comment' => '请求参数'])
|
||||||
|
->addColumn('status', 'boolean', ['limit' => 1, 'default' => 1, 'comment' => '状态 1成功 0失败'])
|
||||||
|
->addColumn('message', 'string', ['limit' => 255, 'default' => '', 'comment' => '消息'])
|
||||||
|
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
|
||||||
|
->create();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user