kopia lustrzana https://github.com/magicbug/Cloudlog
[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 etcpull/747/head
rodzic
c6a17bdf3f
commit
be6550723c
|
@ -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
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue