20210523173324_add_config_field.php 6.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CatchAdmin [Just Like ~ ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
  8. // +----------------------------------------------------------------------
  9. // | Author: JaguarJack [ njphper@gmail.com ]
  10. // +----------------------------------------------------------------------
  11. use think\migration\Migrator;
  12. use think\migration\db\Column;
  13. use Phinx\Db\Adapter\MysqlAdapter;
  14. class AddConfigField extends Migrator
  15. {
  16. /**
  17. * Change Method.
  18. *
  19. * Write your reversible migrations using this method.
  20. *
  21. * More information on writing migrations is available here:
  22. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  23. *
  24. * The following commands can be used in this method and Phinx will
  25. * automatically reverse them when rolling back:
  26. *
  27. * createTable
  28. * renameTable
  29. * addColumn
  30. * renameColumn
  31. * addIndex
  32. * addForeignKey
  33. *
  34. * Remember to call "create()" or "update()" and NOT "save()" when working
  35. * with the Table class.
  36. */
  37. public function change()
  38. {
  39. if ($this->hasTable('station')) {
  40. $table = $this->table('station');
  41. $table ->addColumn('http_request_time', 'datetime', ['null' => true,'signed' => true,'comment' => '设备请求时间',])
  42. ->addColumn('is_enable', 'boolean', ['null' => true,'signed' => true,'comment' => '是否启用',])
  43. ->addColumn('ddzx_ip', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '调度中心ip',])
  44. ->addColumn('ddzx_tcp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '调度中心tcp端口',])
  45. ->addColumn('ddzx_wait_recv_msg_maxTime', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '等待接收超时时间',])
  46. ->addColumn('rfid_offline_timeout', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid离线超时时间',])
  47. ->addColumn('is_reboot_device', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否重启设备',])
  48. ->addColumn('is_restore_device', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否恢复出厂设置',])
  49. ->addColumn('dev_reboot_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备定时重启时间',])
  50. ->addColumn('http_devops_url', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'http运维通道地址',])
  51. ->addColumn('http_devops_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'http运维通道请求间隔',])
  52. ->addColumn('device_sn', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备序列号',])
  53. ->addColumn('is_start_ota', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否升级设备',])
  54. ->addColumn('core_version', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '底层固件版本号',])
  55. ->addColumn('script_version', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '脚本版本号',])
  56. ->addColumn('sim_iccid', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡iccid',])
  57. ->addColumn('sim_imsi', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡imsi',])
  58. ->addColumn('rfid_rssi_filter_val', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rssi信号过滤值',])
  59. ->addColumn('ota_check_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '空中升级检测周期',])
  60. ->addColumn('error_log_report_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '错误日志上报间隔',])
  61. ->addColumn('error_log_report_url', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '错误日志上报地址',])
  62. ->addColumn('data_tcp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道TCP端口',])
  63. ->addColumn('data_udp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道UDP端口',])
  64. ->addColumn('data_ip', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道IP',])
  65. ->addColumn('rfid_report_interval_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid数据上报周期',])
  66. ->addColumn('rfid_buffer_max_count_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid缓存信号数',])
  67. ->addColumn('rfid_enable_throttle_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否启用节流模式',])
  68. ->addColumn('rfid_offline_timeout_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid离线时间阀值',])
  69. ->addColumn('rfid_min_diff_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '首末次信号最小时间差',])
  70. ->update();
  71. }
  72. }
  73. }