THEME MODE - add theme_mode to db

This commit is contained in:
HB9HIL
2024-01-16 01:43:02 +01:00
parent aeb229b7c8
commit b944cd3ce7
2 changed files with 35 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
$config['migration_version'] = 173;
$config['migration_version'] = 174;
/*
|--------------------------------------------------------------------------

View File

@@ -0,0 +1,34 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_add_theme_mode extends CI_Migration {
public function up() {
$fields = array(
'theme_mode VARCHAR(20) AFTER foldername',
);
if (!$this->db->field_exists('theme_mode', 'themes')) {
$this->dbforge->add_column('themes', $fields);
}
$this->db->query("UPDATE themes SET theme_mode = 'light' WHERE foldername = 'cosmo'");
$this->db->query("UPDATE themes SET theme_mode = 'light' WHERE foldername = 'cosmo_wide'");
$this->db->query("UPDATE themes SET theme_mode = 'dark' WHERE foldername = 'cyborg'");
$this->db->query("UPDATE themes SET theme_mode = 'dark' WHERE foldername = 'cyborg_wide'");
$this->db->query("UPDATE themes SET theme_mode = 'dark' WHERE foldername = 'darkly'");
$this->db->query("UPDATE themes SET theme_mode = 'dark' WHERE foldername = 'darkly_wide'");
$this->db->query("UPDATE themes SET theme_mode = 'light' WHERE foldername = 'default'");
$this->db->query("UPDATE themes SET theme_mode = 'light' WHERE foldername = 'default_wide'");
$this->db->query("UPDATE themes SET theme_mode = 'dark' WHERE foldername = 'superhero'");
$this->db->query("UPDATE themes SET theme_mode = 'dark' WHERE foldername = 'superhero_wide'");
}
public function down(){
if ($this->db->field_exists('theme_mode', 'themes')) {
$this->dbforge->drop_column('themes', 'theme_mode');
}
}
}