Update/add MESAT and SONATE-2 and reset LoTW upload for those

This commit is contained in:
phl0
2024-10-24 14:08:29 +02:00
parent 8ead2581a5
commit e1e316f074
2 changed files with 56 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
$config['migration_version'] = 224;
$config['migration_version'] = 225;
/*
|--------------------------------------------------------------------------

View File

@@ -0,0 +1,55 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_lotw_satupdate_mesat_sonate extends CI_Migration
{
public function up() {
$this->db->set('name', 'MO-122');
$this->db->where('name', 'MESAT1');
$this->db->or_where('name', 'MESAT-1');
$this->db->update('satellite');
$this->db->select('COUNT(name) AS count');
$this->db->where('name', 'MO-122');
$query = $this->db->get('satellite');
$row = $query->row();
if ($row->count == 0) {
$data = array('name' => 'MO-122', 'exportname' => '', 'orbit' => 'LEO');
$this->db->insert('satellite', $data);
$this->db->query("INSERT INTO satellitemode (name, satelliteid, uplink_mode, uplink_freq, downlink_mode, downlink_freq) SELECT 'V/U', id, 'LSB', '145925000', 'USB', '435825000' FROM satellite WHERE name = 'MO-122';");
}
$this->db->set('COL_SAT_NAME', 'MO-122');
$this->db->set('COL_LOTW_QSL_SENT', 'N');
$this->db->set('COL_LOTW_QSLSDATE', null);
$this->db->where('COL_SAT_NAME', 'MESAT1');
$this->db->or_where('COL_SAT_NAME', 'MESAT-1');
$this->db->update($this->config->item('table_name'));
$this->db->set('name', 'SONATE');
$this->db->where('name', 'SONATE-2');
$this->db->update('satellite');
$this->db->select('COUNT(name) AS count');
$this->db->where('name', 'SONATE');
$query = $this->db->get('satellite');
$row = $query->row();
if ($row->count == 0) {
$data = array('name' => 'SONATE', 'exportname' => '', 'orbit' => 'LEO');
$this->db->insert('satellite', $data);
$this->db->query("INSERT INTO satellitemode (name, satelliteid, uplink_mode, uplink_freq, downlink_mode, downlink_freq) SELECT 'V/V', id, 'PKT', '145825000', 'PKT', '145825000' FROM satellite WHERE name = 'SONATE';");
}
$this->db->set('COL_SAT_NAME', 'SONATE');
$this->db->set('COL_LOTW_QSL_SENT', 'N');
$this->db->set('COL_LOTW_QSLSDATE', null);
$this->db->where('COL_SAT_NAME', 'SONATE-2');
$this->db->update($this->config->item('table_name'));
}
public function down()
{
// Not Possible
}
}