diff --git a/docs/migrations.rst b/docs/migrations.rst index 367154e1e..60ce886b8 100644 --- a/docs/migrations.rst +++ b/docs/migrations.rst @@ -1150,6 +1150,7 @@ Let's add a foreign key to an example table: } "On delete" and "On update" actions are defined with a 'delete' and 'update' options array. Possibles values are 'SET_NULL', 'NO_ACTION', 'CASCADE' and 'RESTRICT'. +Constraint name can be changed with the 'constraint' option. It is also possible to pass ``addForeignKey()`` an array of columns. This allows us to establish a foreign key relationship to a table which uses a combined key. @@ -1174,7 +1175,7 @@ This allows us to establish a foreign key relationship to a table which uses a c ->addForeignKey(array('user_id', 'follower_id'), 'followers', array('user_id', 'follower_id'), - array('delete'=> 'NO_ACTION', 'update'=> 'NO_ACTION')) + array('delete'=> 'NO_ACTION', 'update'=> 'NO_ACTION', 'constraint' => 'user_follower_id')) ->save(); }