2023-05-26 08:38:31 +00:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Migration_add_lotw_users extends CI_Migration
|
|
|
|
{
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
if (!$this->db->table_exists('lotw_users')) {
|
|
|
|
$this->dbforge->add_field(array(
|
|
|
|
'id' => array(
|
|
|
|
'type' => 'INT',
|
|
|
|
'constraint' => 20,
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
'auto_increment' => TRUE,
|
|
|
|
'unique' => TRUE
|
|
|
|
),
|
|
|
|
'callsign' => array(
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => 32,
|
|
|
|
'unsigned' => TRUE,
|
|
|
|
),
|
|
|
|
'lastupload' => array(
|
2023-05-26 13:22:31 +00:00
|
|
|
'type' => 'datetime',
|
2023-05-26 08:38:31 +00:00
|
|
|
)
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->dbforge->add_key('id', TRUE);
|
|
|
|
|
|
|
|
$this->dbforge->create_table('lotw_users');
|
|
|
|
|
|
|
|
$this->db->query("ALTER TABLE lotw_users ADD INDEX `callsign` (`callsign`)");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
2023-05-26 13:22:31 +00:00
|
|
|
if ($this->db->table_exists('lotw_users')) {
|
2023-05-26 08:38:31 +00:00
|
|
|
$this->dbforge->drop_table('lotw_users');
|
2023-05-26 13:22:31 +00:00
|
|
|
}
|
2023-05-26 08:38:31 +00:00
|
|
|
}
|
|
|
|
}
|