From b944cd3ce7b5616479b47c02c005292c2faaf99c Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Tue, 16 Jan 2024 01:43:02 +0100 Subject: [PATCH] THEME MODE - add theme_mode to db --- application/config/migration.php | 2 +- application/migrations/174_add_theme_mode.php | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 application/migrations/174_add_theme_mode.php diff --git a/application/config/migration.php b/application/config/migration.php index 7bdc9b407..fc454147d 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 173; +$config['migration_version'] = 174; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/174_add_theme_mode.php b/application/migrations/174_add_theme_mode.php new file mode 100644 index 000000000..23674e687 --- /dev/null +++ b/application/migrations/174_add_theme_mode.php @@ -0,0 +1,34 @@ +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'); + } + } +}