Welcome Guest, Not a member yet? Register   Sign In
addColumn IF NOT EXITS
#1

Hi,

I'm new in codeigniter. And yes I read the manual about forge and addColumn. Smile


My Question is:
When you add a table with forge you can check if table exists when you add a TRUE in your Line like written in the manual.

Is there also an option to check if a column I want to add exists?

PHP Code:
    public function updateDatabase() {
      $forge = \Config\Database::forge();

        $addresses = ['sort' => ['type' => 'INT''constraint' => '100''null' => true'after' => 'person_idperson', ],];
        $forge->addColumn('addresses'$addresses);



When I update my page twice I got a Error Message "duplicated column name"

Any Idea how to solve that?

Thanks
Reply
#2

Use migrations to change the database table.
Reply
#3

ok thx I will try....
Reply




Theme © iAndrew 2016 - Forum software by © MyBB