mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Gridmap] Added country grids
This commit is contained in:
36
application/migrations/261_add_grid_country.php
Normal file
36
application/migrations/261_add_grid_country.php
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user