![]() |
Why i cannot add foreign key in migration, it creates different one. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Why i cannot add foreign key in migration, it creates different one. (/showthread.php?tid=90359) |
Why i cannot add foreign key in migration, it creates different one. - sarath_unrelax - 03-06-2024 Hello, Hope you all doing well!,. I'm trying to modify an existing table to add a column which i need to be foreignkey to other table but it not creating. My code : PHP Code: <?php This not creating foreignkey to the leave_applications table. instead it created "leave_adjustment_emp_id_foreign". How i can solve this issue ? This creates column called "leave_application_id" but not creating foreign key, what wrong im doing here ? RE: Why i cannot add foreign key in migration, it creates different one. - kenjis - 03-06-2024 See https://codeigniter4.github.io/CodeIgniter4/dbmgmt/forge.html#adding-keys-to-a-table RE: Why i cannot add foreign key in migration, it creates different one. - sarath_unrelax - 03-06-2024 (03-06-2024, 04:42 PM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgniter4/dbmgmt/forge.html#adding-keys-to-a-table So I need to add this also ? PHP Code: $this->forge->processIndexes('leave_adjustment'); |