[eluser]aktosci[/eluser]
Hello,
I am creating the automatic install of my database
Creation of the table : OK
but when my database is changing , I have to add fields
1st method : CI
Code:
$fields = array('newfield' => array('type' => 'TEXT'));
$this->dbforge->add_column('table', $fields);
--> This methode send me an error when the field exists
A Database Error Occurred
Code:
Error Number: 1060
Duplicate column name 'newfield'
ALTER TABLE `table` ADD `newfield` TEXT
2nd method : classic php
Code:
$strsql = "ALTER TABLE `aaa` ADD `gract_visible` VARCHAR( 1 ) ;";
mysql_query($strsql);
this method does not send me an error when the field exist and I want that !
-->Question : do you have a solution in CI adding fiedl ( I don't know if this new field exist of not )
Second method what is the advantade of using the CI method ?