Constraint Naming Fix

This allows naming of a constraint. Currently, you will only receive the mysql auto named constraint.
Currently only this syntax works: ->addForeignKey( 'client_id', 'clients', 'client_id' )

This fix will allow this syntax to be used: ->addForeignKey( 'client_id', 'clients', 'client_id', array( 'constraint' => 'my_constraint_name_xxx', 'delete' => 'RESTRICT', 'update' => 'RESTRICT' ) )
The "constraint" option was not being handled properly, resulting in invalid SQL syntax

Signed-off-by: Jonathan Galpin <jonathan@iqzero.net>
Done.


On Fri, Jul 25, 2014 at 12:57 PM, Maxi Capodacqua <notifications@github.com>
wrote:

> In src/Phinx/Db/Table/Index.php:
>
> > @@ -128,7 +128,7 @@ public function setOptions($options)
> >
> >              // handle $options['unique']
> >              if (strtolower($option) == self::UNIQUE) {
> > -                $this->setType(self::UNIQUE);
> > +                if( (bool)$value ) $this->setType(self::UNIQUE);
>
> Consider add a new line after the if( (bool)$value ). Otherwise the
> debugging could be more complex
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/robmorgan/phinx/pull/274/files#r15411657>.
>