Refactor migration files for code style consistency

Updated migration files to use consistent PSR-12 code style, including brace placement, indentation, and spacing. Removed closing PHP tags and standardized 'or' in exit statements. No functional changes were made.
这个提交包含在:
Peter Goodhall 2025-08-18 14:07:43 +01:00
父节点 de29c21805
当前提交 1ebb3a9942
共有 4 个文件被更改,包括 51 次插入50 次删除

查看文件

@ -1,21 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); <?php defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_lotw_credentials extends CI_Migration { class Migration_add_lotw_credentials extends CI_Migration
{
public function up() public function up()
{ {
$fields = array( $fields = array(
'user_lotw_name VARCHAR(32) DEFAULT NULL', 'user_lotw_name VARCHAR(32) DEFAULT NULL',
'user_lotw_password VARCHAR(64) DEFAULT NULL' 'user_lotw_password VARCHAR(64) DEFAULT NULL'
); );
$this->dbforge->add_column('users', $fields); $this->dbforge->add_column('users', $fields);
} }
public function down() public function down()
{ {
$this->dbforge->drop_column('users', 'user_lotw_name'); $this->dbforge->drop_column('users', 'user_lotw_name');
$this->dbforge->drop_column('users', 'user_lotw_password'); $this->dbforge->drop_column('users', 'user_lotw_password');
} }
} }
?>

查看文件

@ -1,10 +1,11 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); <?php defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_config_table extends CI_Migration { class Migration_add_config_table extends CI_Migration
{
public function up() public function up()
{ {
$this->dbforge->add_field('id'); $this->dbforge->add_field('id');
$this->dbforge->add_field(array( $this->dbforge->add_field(array(
'lotw_download_url' => array( 'lotw_download_url' => array(
@ -15,7 +16,7 @@ class Migration_add_config_table extends CI_Migration {
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 255, 'constraint' => 255,
), ),
'lotw_rcvd_mark' => array( 'lotw_rcvd_mark' => array(
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 1, 'constraint' => 1,
), ),
@ -24,13 +25,13 @@ class Migration_add_config_table extends CI_Migration {
$this->dbforge->create_table('config'); $this->dbforge->create_table('config');
$data = array( $data = array(
'lotw_download_url' => 'https://p1k.arrl.org/lotwuser/lotwreport.adi', 'lotw_download_url' => 'https://p1k.arrl.org/lotwuser/lotwreport.adi',
'lotw_upload_url' => 'https://p1k.arrl.org/lotwuser/upload', 'lotw_upload_url' => 'https://p1k.arrl.org/lotwuser/upload',
'lotw_rcvd_mark' => 'Y' 'lotw_rcvd_mark' => 'Y'
); );
$this->db->insert('config', $data); $this->db->insert('config', $data);
} }
public function down() public function down()
@ -38,4 +39,3 @@ class Migration_add_config_table extends CI_Migration {
$this->dbforge->drop_table('config'); $this->dbforge->drop_table('config');
} }
} }
?>

查看文件

@ -1,12 +1,13 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); <?php defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_lotw_login_url extends CI_Migration { class Migration_add_lotw_login_url extends CI_Migration
{
public function up() public function up()
{ {
$fields = array('lotw_login_url VARCHAR(244) DEFAULT NULL'); $fields = array('lotw_login_url VARCHAR(244) DEFAULT NULL');
$this->dbforge->add_column('config', $fields); $this->dbforge->add_column('config', $fields);
$sql = "UPDATE config SET lotw_login_url = 'https://p1k.arrl.org/lotwuser/default' WHERE id=1"; $sql = "UPDATE config SET lotw_login_url = 'https://p1k.arrl.org/lotwuser/default' WHERE id=1";
@ -15,7 +16,6 @@ class Migration_add_lotw_login_url extends CI_Migration {
public function down() public function down()
{ {
$this->dbforge->drop_column('config', 'lotw_login_url'); $this->dbforge->drop_column('config', 'lotw_login_url');
} }
} }
?>

查看文件

@ -1,8 +1,9 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_workable_dxcc_indexes extends CI_Migration { class Migration_add_workable_dxcc_indexes extends CI_Migration
{
public function up() public function up()
{ {
@ -11,18 +12,18 @@ class Migration_add_workable_dxcc_indexes extends CI_Migration {
$this->db->db_debug = false; $this->db->db_debug = false;
// Check if index already exists // Check if index already exists
$index_exists = $this->db->query("SHOW INDEX FROM ".$this->config->item('table_name')." WHERE Key_name = 'idx_workable_dxcc'")->num_rows(); $index_exists = $this->db->query("SHOW INDEX FROM " . $this->config->item('table_name') . " WHERE Key_name = 'idx_workable_dxcc'")->num_rows();
if ($index_exists == 0) { if ($index_exists == 0) {
$sql = "ALTER TABLE ".$this->config->item('table_name')." ADD INDEX `idx_workable_dxcc` (`COL_COUNTRY`, `station_id`, `COL_PROP_MODE`)"; $sql = "ALTER TABLE " . $this->config->item('table_name') . " ADD INDEX `idx_workable_dxcc` (`COL_COUNTRY`, `station_id`, `COL_PROP_MODE`)";
$this->db->query($sql); $this->db->query($sql);
} }
// Add index for confirmation status columns // Add index for confirmation status columns
$conf_index_exists = $this->db->query("SHOW INDEX FROM ".$this->config->item('table_name')." WHERE Key_name = 'idx_qsl_confirmations'")->num_rows(); $conf_index_exists = $this->db->query("SHOW INDEX FROM " . $this->config->item('table_name') . " WHERE Key_name = 'idx_qsl_confirmations'")->num_rows();
if ($conf_index_exists == 0) { if ($conf_index_exists == 0) {
$sql = "ALTER TABLE ".$this->config->item('table_name')." ADD INDEX `idx_qsl_confirmations` (`COL_QSL_RCVD`, `COL_LOTW_QSL_RCVD`, `COL_EQSL_QSL_RCVD`, `COL_QRZCOM_QSO_DOWNLOAD_STATUS`)"; $sql = "ALTER TABLE " . $this->config->item('table_name') . " ADD INDEX `idx_qsl_confirmations` (`COL_QSL_RCVD`, `COL_LOTW_QSL_RCVD`, `COL_EQSL_QSL_RCVD`, `COL_QRZCOM_QSO_DOWNLOAD_STATUS`)";
$this->db->query($sql); $this->db->query($sql);
} }
@ -34,14 +35,14 @@ class Migration_add_workable_dxcc_indexes extends CI_Migration {
$this->db->db_debug = false; $this->db->db_debug = false;
// Drop the indexes if they exist // Drop the indexes if they exist
$index_exists = $this->db->query("SHOW INDEX FROM ".$this->config->item('table_name')." WHERE Key_name = 'idx_workable_dxcc'")->num_rows(); $index_exists = $this->db->query("SHOW INDEX FROM " . $this->config->item('table_name') . " WHERE Key_name = 'idx_workable_dxcc'")->num_rows();
if ($index_exists > 0) { if ($index_exists > 0) {
$this->db->query("ALTER TABLE ".$this->config->item('table_name')." DROP INDEX `idx_workable_dxcc`"); $this->db->query("ALTER TABLE " . $this->config->item('table_name') . " DROP INDEX `idx_workable_dxcc`");
} }
$conf_index_exists = $this->db->query("SHOW INDEX FROM ".$this->config->item('table_name')." WHERE Key_name = 'idx_qsl_confirmations'")->num_rows(); $conf_index_exists = $this->db->query("SHOW INDEX FROM " . $this->config->item('table_name') . " WHERE Key_name = 'idx_qsl_confirmations'")->num_rows();
if ($conf_index_exists > 0) { if ($conf_index_exists > 0) {
$this->db->query("ALTER TABLE ".$this->config->item('table_name')." DROP INDEX `idx_qsl_confirmations`"); $this->db->query("ALTER TABLE " . $this->config->item('table_name') . " DROP INDEX `idx_qsl_confirmations`");
} }
$this->db->db_debug = true; $this->db->db_debug = true;