From 9f3f7b326c815e233415f7313f57383079cfd60b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 29 Sep 2017 09:37:25 +0200 Subject: [PATCH] exclude sqlite3 from db migrations as well. fixes #391 --- htdocs/application/controllers/Main.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/application/controllers/Main.php b/htdocs/application/controllers/Main.php index 1b8581f..99301a8 100644 --- a/htdocs/application/controllers/Main.php +++ b/htdocs/application/controllers/Main.php @@ -266,7 +266,7 @@ class Main extends CI_Controller //ipv6 migration $fields = $this->db->field_data('trending'); - if (config_item('db_driver') != 'sqlite' && $fields[1]->max_length < 45) + if (stristr(config_item('db_driver') , 'sqlite') === false && $fields[1]->max_length < 45) { $db_prefix = config_item('db_prefix'); @@ -294,7 +294,7 @@ class Main extends CI_Controller if ($field->name == 'title') { - if (config_item('db_driver') != 'sqlite' && $field->max_length < 50) + if (stristr(config_item('db_driver') , 'sqlite') === false && $field->max_length < 50) { $db_prefix = config_item('db_prefix'); @@ -318,17 +318,21 @@ class Main extends CI_Controller if ($field->name == 'id') { - if ($field->max_length < 128) + if (stristr(config_item('db_driver') , 'sqlite') === false) { - $db_prefix = config_item('db_prefix'); - if ($this->db->dbdriver == "postgre") + if ($field->max_length < 128) { - $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"); + $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"); + } } } }