started the logbook table
这个提交包含在:
父节点
3449ac627d
当前提交
66231b52d2
共有 5 个文件被更改,包括 94 次插入 和 1 次删除
|
|
@ -15,6 +15,6 @@ class Migration_add_column_logbookid extends CI_Migration {
|
|||
|
||||
public function down()
|
||||
{
|
||||
echo "Not possible, sorry.";
|
||||
$this->dbforge->drop_column('logbook_id', $this->config->item('table_name'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_create_logbook_table extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->dbforge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INT',
|
||||
'constraint' => 5,
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
),
|
||||
'logbook_name' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '250',
|
||||
),
|
||||
'modified' => array(
|
||||
'type' => 'timestamp',
|
||||
'null' => TRUE,
|
||||
),
|
||||
));
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->create_table('logbooks');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_table('logbooks');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_addfield_to_logbooks_default extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'default_logbook tinyint(1) DEFAULT NULL',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('logbooks', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('default_logbook', 'logbooks');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_addfield_to_logbooks_active extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'active_logbook tinyint(1) DEFAULT NULL',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('logbooks', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('active_logbook', 'logbooks');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_logbooks_setkeys extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->db->db_debug = false;
|
||||
$this->db->query("ALTER TABLE `logbooks` ADD UNIQUE(`id`);");
|
||||
$this->db->query("ALTER TABLE `logbooks` ADD INDEX(`id`);");
|
||||
$this->db->query("ALTER TABLE `logbooks` ADD INDEX(`logbook_name`);");
|
||||
$this->db->db_debug = true;
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "Not possible, sorry.";
|
||||
}
|
||||
}
|
||||
正在加载…
在新工单中引用