mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Add migration
This commit is contained in:
29
application/migrations/238_add_norad_id_to_sat.php
Normal file
29
application/migrations/238_add_norad_id_to_sat.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_add_norad_id_to_sat extends CI_Migration {
|
||||
|
||||
public function up() {
|
||||
if ($this->db->table_exists('satellite')) {
|
||||
$fields = array(
|
||||
'norad_id' => array(
|
||||
'type' => 'INT',
|
||||
'constraint' => 9,
|
||||
'unsigned' => TRUE,
|
||||
'null' => TRUE,
|
||||
'default' => NULL
|
||||
),
|
||||
);
|
||||
$this->dbforge->add_column('satellite', $fields);
|
||||
}
|
||||
}
|
||||
|
||||
public function down() {
|
||||
if ($this->db->table_exists('satellite')) {
|
||||
if ($this->db->field_exists('norad_id', 'satellite')) {
|
||||
$this->dbforge->drop_column('satellite', 'norad_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user