Update qso_end_date of existing certs where time is 00:00:00

This commit is contained in:
phl0
2023-07-01 23:06:31 +02:00
parent 0c0e9219a3
commit 08765a8bd8
2 changed files with 22 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 124;
$config['migration_version'] = 125;
/*
|--------------------------------------------------------------------------

View File

@@ -0,0 +1,21 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_lotw_enddates extends CI_Migration
{
public function up()
{
if ($this->db->table_exists('lotw_certs')) {
$sql = 'UPDATE lotw_certs SET qso_end_date = DATE_ADD(qso_end_date, INTERVAL 24*60*60 -1 SECOND) WHERE TIME(qso_end_date) = "00:00:00";';
$this->db->query($sql);
}
}
public function down()
{
if ($this->db->table_exists('lotw_certs')) {
$sql = 'UPDATE lotw_certs SET qso_end_date = DATE_SUB(qso_end_date, INTERVAL 24*60*60 -1 SECOND) WHERE TIME(qso_end_date) = "23:59:59";';
$this->db->query($sql);
}
}
}