20191212110930_operate_log.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class OperateLog extends Migrator
  5. {
  6. /**
  7. * Change Method.
  8. *
  9. * Write your reversible migrations using this method.
  10. *
  11. * More information on writing migrations is available here:
  12. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  13. *
  14. * The following commands can be used in this method and Phinx will
  15. * automatically reverse them when rolling back:
  16. *
  17. * createTable
  18. * renameTable
  19. * addColumn
  20. * renameColumn
  21. * addIndex
  22. * addForeignKey
  23. *
  24. * Remember to call "create()" or "update()" and NOT "save()" when working
  25. * with the Table class.
  26. */
  27. public function change()
  28. {
  29. $table = $this->table('operate_log',['engine'=>'Myisam', 'comment' => '操作日志', 'signed' => false]);
  30. $table->addColumn('module', 'string',['limit' => 50,'default'=>'','comment'=>'模块名称'])
  31. ->addColumn('operate', 'string',['default'=> '', 'limit' => 20, 'comment'=>'操作模块'])
  32. ->addColumn('route', 'string',['default'=> '','limit' => 100, 'comment'=>'路由'])
  33. ->addColumn('params', 'string',['default'=> '','limit' => 1000, 'comment'=>'参数'])
  34. ->addColumn('ip', 'string',['default'=>'', 'limit' => 20,'comment'=>'ip', 'signed' => false])
  35. ->addColumn('creator_id', 'integer',['default'=> 0,'comment'=>'创建人ID', 'signed' => false])
  36. ->addColumn('method', 'string',['default'=> '','comment'=>'请求方法'])
  37. ->addColumn('created_at', 'integer', array('default'=>0,'comment'=>'登录时间', 'signed' => false ))
  38. ->create();
  39. }
  40. }