Cloudlog/application/migrations/158_add_qrz_down.php

25 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2023-12-07 16:31:11 +00:00
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_qrz_down extends CI_Migration
{
public function up() {
if (!$this->db->field_exists('COL_QRZCOM_QSO_DOWNLOAD_STATUS', $this->config->item('table_name'))) {
$fields = array(
2023-12-08 14:09:06 +00:00
'COLUMN COL_QRZCOM_QSO_DOWNLOAD_DATE DATETIME NULL DEFAULT NULL',
'COLUMN COL_QRZCOM_QSO_DOWNLOAD_STATUS VARCHAR(10) DEFAULT NULL',
2023-12-07 16:31:11 +00:00
);
2023-12-08 14:15:11 +00:00
$this->dbforge->add_column($this->config->item('table_name'), $fields);
2023-12-07 16:31:11 +00:00
}
}
public function down() {
if ($this->db->field_exists('COL_QRZCOM_QSO_DOWNLOAD_STATUS', $this->config->item('table_name'))) {
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_QRZCOM_QSO_DOWNLOAD_STATUS');
}
if ($this->db->field_exists('COL_QRZCOM_QSO_DOWNLOAD_DATE', $this->config->item('table_name'))) {
$this->dbforge->drop_column($this->config->item('table_name'), 'COL_QRZCOM_QSO_DOWNLOAD_DATE');
}
}
}