Commit f31c6dc3 authored by Dayle Rees's avatar Dayle Rees

Merge pull request #1127 from tobsn/patch-13

Docu on how to ensure foreign() works
parents 926cdaa7 161ae3f6
...@@ -145,3 +145,9 @@ You may also specify options for the "on delete" and "on update" actions of the ...@@ -145,3 +145,9 @@ You may also specify options for the "on delete" and "on update" actions of the
You may also easily drop a foreign key constraint. The default foreign key names follow the [same convention](#dropping-indexes) as the other indexes created by the Schema builder. Here's an example: You may also easily drop a foreign key constraint. The default foreign key names follow the [same convention](#dropping-indexes) as the other indexes created by the Schema builder. Here's an example:
$table->drop_foreign('posts_user_id_foreign'); $table->drop_foreign('posts_user_id_foreign');
> **Note:** The field referenced in the foreign key is very likely an auto increment and therefore automatically an unsigned integer. Please make sure to create the foreign key field with **unsigned()** as both fields have to be the exact same type, the engine on both tables has to be set to **InnoDB**, and the referenced table must be created **before** the table with the foreign key.
$table->engine = 'InnoDB';
$table->integer('user_id')->unsigned();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment