2022-01-26 15:43:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/*
|
|
|
|
Creates column public_slug in table station_logbooks
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Migration_add_public_slug_to_stationlogbooks extends CI_Migration {
|
|
|
|
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
if ($this->db->table_exists('station_logbooks')) {
|
|
|
|
|
|
|
|
$fields = array(
|
|
|
|
'public_slug' => array(
|
|
|
|
'type' => 'VARCHAR',
|
2022-02-05 16:15:00 +00:00
|
|
|
'constraint' => '191',
|
2022-01-26 15:43:44 +00:00
|
|
|
'null' => TRUE,
|
|
|
|
'unique' => TRUE
|
|
|
|
)
|
2022-02-05 16:15:00 +00:00
|
|
|
);
|
2022-01-26 15:43:44 +00:00
|
|
|
|
2022-02-05 16:15:00 +00:00
|
|
|
if (!$this->db->field_exists('public_slug', 'station_logbooks')) {
|
|
|
|
$this->dbforge->add_column('station_logbooks', $fields);
|
2022-01-26 15:43:44 +00:00
|
|
|
|
2022-02-05 16:15:00 +00:00
|
|
|
$this->dbforge->add_key('public_slug');
|
|
|
|
}
|
|
|
|
|
2022-01-26 15:43:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
$this->dbforge->drop_column('station_logbooks', 'public_slug');
|
|
|
|
}
|
|
|
|
}
|