kopia lustrzana https://github.com/magicbug/Cloudlog
[CAT] rename rx columns
rodzic
49d1a13365
commit
88982bcb09
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 99;
|
||||
$config['migration_version'] = 100;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -51,18 +51,18 @@
|
|||
|
||||
if (empty($row->frequency) || $row->frequency == "0") {
|
||||
echo "<td>- / -</td>";
|
||||
} elseif (empty($row->downlink_freq) || $row->downlink_freq == "0") {
|
||||
} elseif (empty($row->frequency_rx) || $row->frequency_rx == "0") {
|
||||
echo "<td>".$this->frequency->hz_to_mhz($row->frequency)."</td>";
|
||||
} else {
|
||||
echo "<td>".$this->frequency->hz_to_mhz($row->downlink_freq)." / ".$this->frequency->hz_to_mhz($row->frequency)."</td>";
|
||||
echo "<td>".$this->frequency->hz_to_mhz($row->frequency_rx)." / ".$this->frequency->hz_to_mhz($row->frequency)."</td>";
|
||||
}
|
||||
|
||||
if (empty($row->mode) || $row->mode == "non") {
|
||||
echo "<td>N/A</td>";
|
||||
} elseif (empty($row->downlink_mode) || $row->downlink_mode == "non") {
|
||||
} elseif (empty($row->mode_rx) || $row->mode_rx == "non") {
|
||||
echo "<td>".$row->mode."</td>";
|
||||
} else {
|
||||
echo "<td>".$row->downlink_mode." / ".$row->mode."</td>";
|
||||
echo "<td>".$row->mode_rx." / ".$row->mode."</td>";
|
||||
}
|
||||
|
||||
$phpdate = strtotime($row->timestamp);
|
||||
|
@ -94,22 +94,21 @@
|
|||
|
||||
$frequency = $row->frequency;
|
||||
|
||||
$frequency_rx = $row->downlink_freq;
|
||||
$frequency_rx = $row->frequency_rx;
|
||||
|
||||
$power = $row->power;
|
||||
|
||||
$prop_mode = $row->prop_mode;
|
||||
|
||||
// Check Mode
|
||||
if(strtoupper($row->mode) == "FMN"){
|
||||
$mode = strtoupper($row->mode);
|
||||
if ($mode == "FMN") {
|
||||
$mode = "FM";
|
||||
} else {
|
||||
$mode = strtoupper($row->mode);
|
||||
}
|
||||
|
||||
if ($row->prop_mode == "SAT") {
|
||||
// Get Satellite Name
|
||||
if($row->sat_name == "AO-07") {
|
||||
if ($row->sat_name == "AO-07") {
|
||||
$sat_name = "AO-7";
|
||||
} elseif ($row->sat_name == "LILACSAT") {
|
||||
$sat_name = "CAS-3H";
|
||||
|
@ -119,7 +118,7 @@
|
|||
|
||||
// Get Satellite Mode
|
||||
$uplink_mode = $this->get_mode_designator($row->frequency);
|
||||
$downlink_mode = $this->get_mode_designator($row->downlink_freq);
|
||||
$downlink_mode = $this->get_mode_designator($row->frequency_rx);
|
||||
|
||||
if (empty($uplink_mode)) {
|
||||
$sat_mode = "";
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
Update CAT table
|
||||
*/
|
||||
|
||||
class Migration_update_cat_table extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
if ($this->db->table_exists('cat')) {
|
||||
if ($this->db->field_exists('uplink_freq', 'cat')) {
|
||||
$this->dbforge->drop_column('cat', 'uplink_freq');
|
||||
}
|
||||
if ($this->db->field_exists('uplink_mode', 'cat')) {
|
||||
$this->dbforge->drop_column('cat', 'uplink_mode');
|
||||
}
|
||||
if ($this->db->field_exists('downlink_freq', 'cat')) {
|
||||
$this->db->query("ALTER TABLE cat RENAME COLUMN downlink_freq TO frequency_rx");
|
||||
}
|
||||
if ($this->db->field_exists('downlink_mode', 'cat')) {
|
||||
$this->db->query("ALTER TABLE cat RENAME COLUMN downlink_mode TO mode_rx");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->table_exists('cat')) {
|
||||
if ($this->db->field_exists('frequency_rx', 'cat')) {
|
||||
$this->db->query("ALTER TABLE cat RENAME COLUMN frequency_rx TO downlink_freq");
|
||||
}
|
||||
if ($this->db->field_exists('mode_rx', 'cat')) {
|
||||
$this->db->query("ALTER TABLE cat RENAME COLUMN mode_rx TO downlink_mode");
|
||||
}
|
||||
if (!$this->db->field_exists('uplink_freq', 'cat')) {
|
||||
$fields = array(
|
||||
'uplink_freq bigint(13) DEFAULT NULL AFTER `downlink_freq`',
|
||||
);
|
||||
$this->dbforge->add_column('cat', $fields);
|
||||
}
|
||||
if (!$this->db->field_exists('uplink_mode', 'cat')) {
|
||||
$fields = array(
|
||||
'uplink_mode varchar(255) DEFAULT NULL AFTER `downlink_mode`',
|
||||
);
|
||||
$this->dbforge->add_column('cat', $fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,18 +37,18 @@
|
|||
$data['mode'] = $result['uplink_mode'];
|
||||
}
|
||||
if (isset($result['frequency_rx'])) {
|
||||
$data['downlink_freq'] = $result['frequency_rx'];
|
||||
$data['frequency_rx'] = $result['frequency_rx'];
|
||||
} else if (isset($result['downlink_freq'])) {
|
||||
$data['downlink_freq'] = $result['downlink_freq'];
|
||||
$data['frequency_rx'] = $result['downlink_freq'];
|
||||
} else {
|
||||
$data['downlink_freq'] = NULL;
|
||||
$data['frequency_rx'] = NULL;
|
||||
}
|
||||
if (isset($result['mode_rx'])) {
|
||||
$data['downlink_mode'] = $result['mode_rx'];
|
||||
$data['mode_rx'] = $result['mode_rx'];
|
||||
} else if (isset($result['downlink_freq'])) {
|
||||
$data['downlink_mode'] = $result['downlink_mode'];
|
||||
$data['mode_rx'] = $result['downlink_mode'];
|
||||
} else {
|
||||
$data['downlink_mode'] = NULL;
|
||||
$data['mode_rx'] = NULL;
|
||||
}
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
|
|
Ładowanie…
Reference in New Issue