kopia lustrzana https://github.com/magicbug/Cloudlog
Fixed hardcoding of tables
rodzic
a39f1d3707
commit
9b787bbb1f
|
@ -14,12 +14,12 @@ class Migration_add_wwff_columns extends CI_Migration {
|
||||||
|
|
||||||
public function up()
|
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(
|
$fields = array(
|
||||||
'COL_WWFF_REF VARCHAR(30) DEFAULT NULL',
|
'COL_WWFF_REF VARCHAR(30) DEFAULT NULL',
|
||||||
'COL_MY_WWFF_REF VARCHAR(50) 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
|
// 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
|
// 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_INFO', '');
|
||||||
$this->db->set('COL_SIG', '');
|
$this->db->set('COL_SIG', '');
|
||||||
$this->db->where('COL_SIG', 'WWFF');
|
$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
|
// Add MY_WWFF_REF to station profile
|
||||||
$fields = array(
|
$fields = array(
|
||||||
|
@ -39,8 +39,8 @@ class Migration_add_wwff_columns extends CI_Migration {
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_WWFF_REF');
|
$this->dbforge->drop_column($this->config->item('table_name'), '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_MY_WWFF_REF');
|
||||||
$this->dbforge->drop_column('station_profile', 'station_wwff');
|
$this->dbforge->drop_column('station_profile', 'station_wwff');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ class Migration_add_pota_columns extends CI_Migration {
|
||||||
|
|
||||||
public function up()
|
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(
|
$fields = array(
|
||||||
'COL_POTA_REF VARCHAR(30) DEFAULT NULL',
|
'COL_POTA_REF VARCHAR(30) DEFAULT NULL',
|
||||||
'COL_MY_POTA_REF VARCHAR(50) 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
|
// 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
|
// 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_INFO', '');
|
||||||
$this->db->set('COL_SIG', '');
|
$this->db->set('COL_SIG', '');
|
||||||
$this->db->where('COL_SIG', 'POTA');
|
$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')) {
|
if (!$this->db->field_exists('station_pota', 'station_profile')) {
|
||||||
|
@ -52,11 +52,11 @@ class Migration_add_pota_columns extends CI_Migration {
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
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'))) {
|
||||||
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_POTA_REF');
|
$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')) {
|
if ($this->db->field_exists('COL_MY_POTA_REF', $this->config->item('table_name'))) {
|
||||||
$this->dbforge->drop_column('TABLE_HRD_CONTACTS_V01', 'COL_MY_POTA_REF');
|
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_MY_POTA_REF');
|
||||||
}
|
}
|
||||||
if ($this->db->field_exists('station_pota', 'station_profile')) {
|
if ($this->db->field_exists('station_pota', 'station_profile')) {
|
||||||
$this->dbforge->drop_column('station_profile', 'station_pota');
|
$this->dbforge->drop_column('station_profile', 'station_pota');
|
||||||
|
|
|
@ -105,7 +105,7 @@ class Activators_model extends CI_Model
|
||||||
|
|
||||||
// Get max no of activated grids of single operator
|
// Get max no of activated grids of single operator
|
||||||
$data = $this->db->query(
|
$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){
|
foreach($data->result() as $row){
|
||||||
$max = $row->count;
|
$max = $row->count;
|
||||||
|
|
Ładowanie…
Reference in New Issue