diff --git a/htdocs/application/controllers/Main.php b/htdocs/application/controllers/Main.php index 6cd43fe..1b8581f 100644 --- a/htdocs/application/controllers/Main.php +++ b/htdocs/application/controllers/Main.php @@ -312,18 +312,25 @@ class Main extends CI_Controller //upgrade to CI 3.1.2 $fields = $this->db->field_data('sessions'); - - if ($field->max_length < 128) + foreach ($fields as $field) { - $db_prefix = config_item('db_prefix'); - if ($this->db->dbdriver == "postgre") + if ($field->name == 'id') { - $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN id SET DATA TYPE varchar(128)"); - } - else - { - $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE id id VARCHAR(128) NOT NULL"); + + if ($field->max_length < 128) + { + $db_prefix = config_item('db_prefix'); + + if ($this->db->dbdriver == "postgre") + { + $this->db->query("ALTER TABLE " . $db_prefix . "sessions ALTER COLUMN id SET DATA TYPE varchar(128)"); + } + else + { + $this->db->query("ALTER TABLE " . $db_prefix . "sessions CHANGE id id VARCHAR(128) NOT NULL"); + } + } } } }