diff --git a/application/migrations/076_theme_table.php b/application/migrations/076_theme_table.php index 9bcf6ce8..4dcc9b86 100644 --- a/application/migrations/076_theme_table.php +++ b/application/migrations/076_theme_table.php @@ -5,17 +5,18 @@ class Migration_Theme_table extends CI_Migration { public function up() { // create themes table - $this->db->query("create table themes (id integer not null auto_increment, name varchar(256) not null, foldername varchar(256) not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); - $this->db->query("INSERT INTO themes (name, foldername) values ('Blue','blue');"); - $this->db->query("INSERT INTO themes (name, foldername) values ('Cosmo','cosmo');"); - $this->db->query("INSERT INTO themes (name, foldername) values ('Cyborg (Dark)','cyborg');"); - $this->db->query("INSERT INTO themes (name, foldername) values ('Darkly (Dark)','darkly');"); - $this->db->query("INSERT INTO themes (name, foldername) values ('Default','default');"); - $this->db->query("INSERT INTO themes (name, foldername) values ('Superhero (Dark)','superhero');"); + if (!$this->db->table_exists('themes')) { + $this->db->query("create table themes (id integer not null auto_increment, name varchar(256) not null, foldername varchar(256) not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); + $this->db->query("INSERT INTO themes (name, foldername) values ('Blue','blue');"); + $this->db->query("INSERT INTO themes (name, foldername) values ('Cosmo','cosmo');"); + $this->db->query("INSERT INTO themes (name, foldername) values ('Cyborg (Dark)','cyborg');"); + $this->db->query("INSERT INTO themes (name, foldername) values ('Darkly (Dark)','darkly');"); + $this->db->query("INSERT INTO themes (name, foldername) values ('Default','default');"); + $this->db->query("INSERT INTO themes (name, foldername) values ('Superhero (Dark)','superhero');"); + } } public function down(){ $this->db->query(""); - } } diff --git a/application/migrations/077_add_userid_to_notes.php b/application/migrations/077_add_userid_to_notes.php index 280dd4e9..e15f3043 100644 --- a/application/migrations/077_add_userid_to_notes.php +++ b/application/migrations/077_add_userid_to_notes.php @@ -9,7 +9,9 @@ class Migration_add_userid_to_notes extends CI_Migration 'user_id BIGINT(20) DEFAULT NULL', ); - $this->dbforge->add_column('notes', $fields); + if (!$this->db->field_exists('user_id', 'notes')) { + $this->dbforge->add_column('notes', $fields); + } } public function down() diff --git a/application/migrations/078_add_userid_to_hardware.php b/application/migrations/078_add_userid_to_hardware.php index 8abba611..9edb4fd4 100644 --- a/application/migrations/078_add_userid_to_hardware.php +++ b/application/migrations/078_add_userid_to_hardware.php @@ -10,7 +10,9 @@ class Migration_add_userid_to_hardware extends CI_Migration { 'user_id BIGINT(20) DEFAULT NULL', ); - $this->dbforge->add_column('cat', $fields); + if (!$this->db->field_exists('user_id', 'cat')) { + $this->dbforge->add_column('cat', $fields); + } } public function down()