-
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
bugSomething isn't workingSomething isn't workingresolvedThis issue has been fixed and the solution has been released in a stable version.This issue has been fixed and the solution has been released in a stable version.
Description
How to reproduce
- Have an existing table named 'taxonomies'
- Update the taxonomy config file to use a different table name (ie 'categories')
- Run migration
When adding child taxonomies, such as if you're migrating taxonomies from the old table to the new one, it may produce a database error because the foreign key constraint fails
Expected Behavior
The foreign key constraints should reference the custom table
Solution
In the current migration the constraint is using a hard-coded table name
$table->foreignId('parent_id')->nullable()->constrained('taxonomies');It should be updated to
$table->foreignId('parent_id')->nullable()->constrained($tableNames['taxonomies']);Additionally, I presume the taxonomables table should also specify the constraint
$table->foreignId('taxonomy_id')->constrained()->cascadeOnDelete();should be updated to
$table->foreignId('taxonomy_id')->constrained($tableNames['taxonomies'])->cascadeOnDelete();Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingresolvedThis issue has been fixed and the solution has been released in a stable version.This issue has been fixed and the solution has been released in a stable version.