UUID for locations / export / import / create

This commit is contained in:
int2001
2025-11-05 11:37:43 +00:00
parent 45972218c7
commit 48b75d4c15
5 changed files with 33 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_station_uuid extends CI_Migration
{
public function up()
{
$this->dbtry("ALTER TABLE station_profile ADD COLUMN station_uuid varchar(36) DEFAULT NULL AFTER webadifrealtime");
$this->dbtry("UPDATE station_profile SET station_uuid = UUID() WHERE station_uuid IS NULL");
}
public function down()
{
$this->dbtry("ALTER TABLE station_profile DROP COLUMN station_uuid");
}
function dbtry($what) {
try {
$this->db->query($what);
} catch (Exception $e) {
log_message("error", "Something gone wrong while altering station_uuid: ".$e." // Executing: ".$this->db->last_query());
}
}
}