Skip to content
Advertisement

Tag: database-migration

How to use foreign keys migration with database migrations. (errno: 150 “Foreign key constraint is incorrectly formed”)?

CodeIgniter 4 has a handy solution for migrations and seeders. Without the usage of foreign keys, everything is working perfectly. But when I use foreign keys I get “Unable to add foreign key”. This is because of the order of happenings: Quick example: So when I now run php spark migrate or php spark migrate:refresh the foreign key can not

Dropping column with foreign key Laravel error: General error: 1025 Error on rename

I’ve created a table using migration like this: I need to change this table and drop the foreign key reference & column pick_detail_id and add a new varchar column called sku after pick_id column. So, I’ve created another migration, which looks like this: When I run this migration, I get the following error: [IlluminateDatabaseQueryException] SQLSTATE[HY000]: General error: 1025 Error on

Use one Laravel migrations table per database

I work in a project that uses multiple databases. It seems like Laravel only uses the migrations-table in the database that is set as default. I would like one migrations table per database that logs the migrations that have been done to that specific database. Is this possible? I have defined the databases in the config like this: I also

Advertisement