[Global Options] Created Migration for table "options" and added theme and default

This will be for global variables, anything that needs to stick for every user, default theme, dates etc etc etc
这个提交包含在:
Peter Goodhall 2020-12-10 17:45:44 +00:00
父节点 c6a17bdf3f
当前提交 be6550723c
共有 3 个文件被更改,包括 75 次插入1 次删除

查看文件

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 57;
$config['migration_version'] = 59;
/*
|--------------------------------------------------------------------------

查看文件

@ -0,0 +1,49 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This migration creates a table called options which will hold global options needed within cloudlog
* removing the need for lots of configuration files.
*/
class Migration_new_options_table extends CI_Migration {
public function up()
{
$this->dbforge->add_field(array(
'option_id' => array(
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'option_name' => array(
'type' => 'VARCHAR',
'constraint' => '191',
'null' => TRUE,
'unique' => TRUE,
),
'option_value' => array(
'type' => 'longtext',
),
'autoload' => array(
'type' => 'varchar',
'constraint' => '20',
'null' => TRUE,
)
));
$this->dbforge->add_key('option_id', TRUE);
$this->dbforge->create_table('options');
}
public function down()
{
$this->dbforge->drop_table('options');
}
}

查看文件

@ -0,0 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This migration creates a table called options which will hold global options needed within cloudlog
* removing the need for lots of configuration files.
*/
class Migration_add_default_theme_to_options_table extends CI_Migration {
public function up()
{
$data = array(
array('option_name' => "theme", 'option_value' => "default", 'autoload' => "yes")
);
$this->db->insert_batch('options', $data);
}
public function down()
{
// No option to down
}
}