table('devices', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]); $table->addColumn('imei', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => 'GPS编号',]) ->addColumn('rfid', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '标签编号',]) ->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备名称',]) ->addColumn('alarm_state', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '告警状态',]) ->addColumn('model', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备型号',]) ->addColumn('bind_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '关联物体',]) ->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '所属部门',]) ->addColumn('iccid', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'ICCID',]) ->addColumn('scenario', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '应用场景',]) ->addColumn('sim_no', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'SIM卡号',]) ->addColumn('longitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '经度',]) ->addColumn('latitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '纬度',]) ->addColumn('loc_mode', 'string', ['limit' => 16,'null' => true,'signed' => true,'comment' => '定位类型',]) ->addColumn('address', 'string', ['limit' => 200,'null' => true,'signed' => true,'comment' => '安装地址',]) ->addColumn('online_time', 'datetime', ['null' => true,'signed' => true,'comment' => '在线时间',]) ->addColumn('soft_ver', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '软件版本',]) ->addColumn('hard_ver', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '硬件版本',]) ->addColumn('remark', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '备注',]) ->addColumn('battery_level', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '电量',]) ->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',]) ->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',]) ->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',]) ->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',]) ->create(); } }