[Gridmap] Added country grids

This commit is contained in:
Andreas Kristiansen
2025-10-18 19:36:17 +02:00
parent 6be185b29e
commit 0ba4c8bd9c
9 changed files with 200 additions and 55 deletions

View File

@@ -0,0 +1,36 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
Create table vuccgrids for use in Gridmap country filtering
*/
class Migration_add_grid_country extends CI_Migration {
public function up()
{
$sql = "CREATE TABLE IF NOT EXISTS vuccgrids (
id INT AUTO_INCREMENT PRIMARY KEY,
adif INT NOT NULL,
gridsquare VARCHAR(8) NOT NULL,
UNIQUE KEY uq_adif_grid (adif, gridsquare)
);";
$this->dbtry($sql);
}
public function down()
{
$sql = "DROP TABLE IF EXISTS vuccgrids;";
$this->dbtry($sql);
}
function dbtry($what) {
try {
$this->db->query($what);
} catch (Exception $e) {
log_message("error", "Something gone wrong while altering a table: ".$e." // Executing: ".$this->db->last_query());
}
}
}