Fixed hardcoding of tables

pull/1964/head
Andreas 2023-01-28 15:21:09 +01:00
rodzic a39f1d3707
commit 9b787bbb1f
3 zmienionych plików z 13 dodań i 13 usunięć

Wyświetl plik

@ -14,12 +14,12 @@ class Migration_add_wwff_columns extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('COL_WWFF_REF', 'TABLE_HRD_CONTACTS_V01')) {
if (!$this->db->field_exists('COL_WWFF_REF', $this->config->item('table_name'))) {
$fields = array(
'COL_WWFF_REF VARCHAR(30) DEFAULT NULL',
'COL_MY_WWFF_REF VARCHAR(50) DEFAULT NULL',
);
$this->dbforge->add_column('TABLE_HRD_CONTACTS_V01', $fields, 'COL_VUCC_GRIDS');
$this->dbforge->add_column($this->config->item('table_name'), $fields, 'COL_VUCC_GRIDS');
// Now copy over data from SIG_INFO fields and remove COL_SIG and COL_SIG_INFO only if COL_SIG is WWFF
// This cannot be reverted on downgrade to prevent overwriting of other COL_SIG information
@ -27,7 +27,7 @@ class Migration_add_wwff_columns extends CI_Migration {
$this->db->set('COL_SIG_INFO', '');
$this->db->set('COL_SIG', '');
$this->db->where('COL_SIG', 'WWFF');
$this->db->update('TABLE_HRD_CONTACTS_V01');
$this->db->update($this->config->item('table_name'));
// Add MY_WWFF_REF to station profile
$fields = array(
@ -39,8 +39,8 @@ class Migration_add_wwff_columns extends CI_Migration {
public function down()
{
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_WWFF_REF');
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_MY_WWFF_REF');
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_WWFF_REF');
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_MY_WWFF_REF');
$this->dbforge->drop_column('station_profile', 'station_wwff');
}
}

Wyświetl plik

@ -14,12 +14,12 @@ class Migration_add_pota_columns extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('COL_POTA_REF', 'TABLE_HRD_CONTACTS_V01')) {
if (!$this->db->field_exists('COL_POTA_REF', $this->config->item('table_name'))) {
$fields = array(
'COL_POTA_REF VARCHAR(30) DEFAULT NULL',
'COL_MY_POTA_REF VARCHAR(50) DEFAULT NULL',
);
$this->dbforge->add_column('TABLE_HRD_CONTACTS_V01', $fields, 'COL_VUCC_GRIDS');
$this->dbforge->add_column($this->config->item('table_name'), $fields, 'COL_VUCC_GRIDS');
// Now copy over data from SIG_INFO fields and remove COL_SIG and COL_SIG_INFO only if COL_SIG is POTA
// This cannot be reverted on downgrade to prevent overwriting of other COL_SIG information
@ -27,7 +27,7 @@ class Migration_add_pota_columns extends CI_Migration {
$this->db->set('COL_SIG_INFO', '');
$this->db->set('COL_SIG', '');
$this->db->where('COL_SIG', 'POTA');
$this->db->update('TABLE_HRD_CONTACTS_V01');
$this->db->update($this->config->item('table_name'));
}
if (!$this->db->field_exists('station_pota', 'station_profile')) {
@ -52,11 +52,11 @@ class Migration_add_pota_columns extends CI_Migration {
public function down()
{
if ($this->db->field_exists('COL_POTA_REF', 'TABLE_HRD_CONTACTS_V01')) {
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_POTA_REF');
if ($this->db->field_exists('COL_POTA_REF', $this->config->item('table_name'))) {
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_POTA_REF');
}
if ($this->db->field_exists('COL_MY_POTA_REF', 'TABLE_HRD_CONTACTS_V01')) {
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_MY_POTA_REF');
if ($this->db->field_exists('COL_MY_POTA_REF', $this->config->item('table_name'))) {
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_MY_POTA_REF');
}
if ($this->db->field_exists('station_pota', 'station_profile')) {
$this->dbforge->drop_column('station_profile', 'station_pota');

Wyświetl plik

@ -105,7 +105,7 @@ class Activators_model extends CI_Model
// Get max no of activated grids of single operator
$data = $this->db->query(
"select COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from TABLE_HRD_CONTACTS_V01 WHERE station_id in (" . $location_list . ") AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` ORDER BY `count` DESC LIMIT 1"
"select COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from " . $this->config->item('table_name') . " WHERE station_id in (" . $location_list . ") AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` ORDER BY `count` DESC LIMIT 1"
);
foreach($data->result() as $row){
$max = $row->count;