![]() |
Migrations - 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: Migrations (/showthread.php?tid=66101) |
Migrations - mgilberties - 09-05-2016 I am using migrations to create some tables, something which is new to me. I have the following tables: Customer id - PK company_name type_id - FK - Customer_Type(id) Customer_Type id - PK type_description My migration looks like so: PHP Code: <?php The problem being this migration runs before the next which creates the Customer_Type lookup table and thus fails with: Code: Database error: A Database Error Occurred How do people handle the addition of constraints/foreign keys through migrations? Am I to lump related tables into one migration and then add the constraint after the creation of each table? Open to suggestions and best practices. |