diff --git a/application/config/migration.php b/application/config/migration.php index 639035721..3090a89d2 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 99; +$config['migration_version'] = 100; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Radio.php b/application/controllers/Radio.php index 9d9877426..94c4b8e01 100755 --- a/application/controllers/Radio.php +++ b/application/controllers/Radio.php @@ -51,18 +51,18 @@ if (empty($row->frequency) || $row->frequency == "0") { echo "- / -"; - } elseif (empty($row->downlink_freq) || $row->downlink_freq == "0") { + } elseif (empty($row->frequency_rx) || $row->frequency_rx == "0") { echo "".$this->frequency->hz_to_mhz($row->frequency).""; } else { - echo "".$this->frequency->hz_to_mhz($row->downlink_freq)." / ".$this->frequency->hz_to_mhz($row->frequency).""; + echo "".$this->frequency->hz_to_mhz($row->frequency_rx)." / ".$this->frequency->hz_to_mhz($row->frequency).""; } if (empty($row->mode) || $row->mode == "non") { echo "N/A"; - } elseif (empty($row->downlink_mode) || $row->downlink_mode == "non") { + } elseif (empty($row->mode_rx) || $row->mode_rx == "non") { echo "".$row->mode.""; } else { - echo "".$row->downlink_mode." / ".$row->mode.""; + echo "".$row->mode_rx." / ".$row->mode.""; } $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 = ""; diff --git a/application/migrations/100_update_cat_table.php b/application/migrations/100_update_cat_table.php new file mode 100644 index 000000000..1b7c45ef3 --- /dev/null +++ b/application/migrations/100_update_cat_table.php @@ -0,0 +1,52 @@ +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); + } + } + } +} diff --git a/application/models/Cat.php b/application/models/Cat.php index 484b35166..b1b5b20ff 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -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)