Creating a foreign key |
Hi,
I would like to know how to create a foreign key in codeigniter's migration
Right know this must be done by a custom query like
PHP Code: $this->db->query('alter table ....'); For mysqli there was a project to do that but i dont know if it works https://github.com/DamexHr/CodeIgniter/t...reign_key/
I also encountered such problem with foreign keys Can't make it using query builder.
some people advise something like this, but i can't make it work; $this->dbforge->add_field('id INT NOT NULL AUTO_INCREMENT PRIMARY KEY'); $this->dbforge->add_field('CONSTRAINT FOREIGN KEY (id) REFERENCES table(id)'); Is it possible in current version of codeigniter? |
Welcome Guest, Not a member yet? Register Sign In |