Cloudlog/application/migrations/090_make_mode_frequency_nul...

55 wiersze
1.8 KiB
PHP
Czysty Zwykły widok Historia

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Class Migration_make_mode_frequency_null
*
2022-04-08 20:01:07 +00:00
* Modify frequency and mode column so that NULL is allowed
* Basically for propmode != SAT
*
*/
class Migration_make_mode_frequency_null extends CI_Migration {
public function up()
{
if ($this->db->field_exists('frequency', 'cat')) {
$fields = array(
'frequency' => array(
'type' => 'VARCHAR(10) NULL',
),
);
$this->dbforge->modify_column('cat', $fields);
}
if ($this->db->field_exists('mode', 'cat')) {
$fields = array(
'mode' => array(
'type' => 'VARCHAR(10) NULL',
),
);
$this->dbforge->modify_column('cat', $fields);
}
}
public function down()
{
if ($this->db->field_exists('frequency', 'cat')) {
$fields = array(
'frequency' => array(
'type' => 'VARCHAR(10) NOT NULL',
),
);
$this->dbforge->modify_column('cat', $fields);
}
if ($this->db->field_exists('mode', 'cat')) {
$fields = array(
'mode' => array(
'type' => 'VARCHAR(10) NOT NULL',
),
);
$this->dbforge->modify_column('cat', $fields);
}
}
}