Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to specify a name for foreign constraints in the schema builder of Laravel?

Tags:

php

laravel

Why the foreign constraint name have no the prefix specified by 'DB_PREFIX'? Two programs using the same database would fail, because they have the same constraint name . I try to google it and read in Laravel documentation but I can't get anything about it.

like image 338
jamlee Avatar asked Nov 20 '15 05:11

jamlee


1 Answers

According to the API docs you can give the contraint a custom name

Fluent foreign(string|array $columns, string $name = null)
like image 135
JackPoint Avatar answered Sep 26 '22 14:09

JackPoint