Skip to content

Removing foreign key constraints from create_permissions_table #2258

Answered by drbyte
mlobalobal asked this question in Q&A
Discussion options

You must be logged in to vote

NOTE: WITHOUT FOREIGN KEY CONSTRAINTS ENFORCED, YOUR DATA WILL LOSE INTEGRITY. The package enforces "some" but NOT ALL relationships internally. It DOES rely on the foreign key constraints to maintain consistency and to delete related records.

That said ...

To prevent the migration from setting foreign key relationships you can delete the $table->foreign()....; command from the migration file before running it.
or
If you need to remove the foreign key constraint after the migration is already run, create a new migration to remove it.
The command in the migration would be something like: $table->dropForeign('name_of_foreign_key_here');. Repeat for each relationship.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by drbyte
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants