20210521151719_station.php 5.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. use Phinx\Db\Adapter\MysqlAdapter;
  5. class Station extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. $table = $this->table('station', ['engine' => 'InnoDB', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
  31. $table->addColumn('station_name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '基站名称',])
  32. ->addColumn('station_mac', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站Mac',])
  33. ->addColumn('station_code', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站简码',])
  34. ->addColumn('station_type', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '基站类型',])
  35. ->addColumn('longitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '经度',])
  36. ->addColumn('latitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '纬度',])
  37. ->addColumn('coordinate_x', 'integer', ['limit' => 4,'null' => true,'signed' => true,'comment' => 'x轴坐标',])
  38. ->addColumn('coordinate_y', 'integer', ['limit' => 4,'null' => true,'signed' => true,'comment' => 'y轴坐标',])
  39. ->addColumn('access_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '出入口id',])
  40. ->addColumn('province_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '省',])
  41. ->addColumn('city_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '市',])
  42. ->addColumn('district_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '县区',])
  43. ->addColumn('online_time', 'datetime', ['null' => true,'signed' => true,'comment' => '在线时间',])
  44. ->addColumn('install_photo', 'string', ['limit' => 200,'null' => true,'signed' => true,'comment' => '安装图片',])
  45. ->addColumn('orientation', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '基站朝向 0-未知 1-朝外 2-朝内',])
  46. ->addColumn('school_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '学校id',])
  47. ->addColumn('station_model', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站型号',])
  48. ->addColumn('station_sn', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '基站串号',])
  49. ->addColumn('station_version', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站版本',])
  50. ->addColumn('wan_ip', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => 'WAN口IP',])
  51. ->addColumn('net_model', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '网络模式 0-静态地址,1-动态获取,2-PPPOE拨号,3-3G拨号,4-4G拨号',])
  52. ->addColumn('rssi', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '信号强度(dbm)',])
  53. ->addColumn('sim_serial_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡序列号',])
  54. ->addColumn('cmcc_phone_id', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '话机编号',])
  55. ->addColumn('attendance_config', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '考勤配置',])
  56. ->addColumn('device_status', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '设备状态',])
  57. ->addColumn('rssi_sensitive', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 62,'signed' => true,'comment' => '信号灵敏度 默认62,大于此值会被过滤',])
  58. ->addColumn('throttling', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '节流 0-关闭,1-开启',])
  59. ->addColumn('address', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '安装地址',])
  60. ->addColumn('enable_push_qywx', 'boolean', ['null' => false,'default' => 0,'signed' => true,'comment' => '推送企业微信0-否,1-是',])
  61. ->addColumn('building_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '建筑id',])
  62. ->addColumn('floor_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '楼层id',])
  63. ->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
  64. ->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
  65. ->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
  66. ->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
  67. ->create();
  68. }
  69. }