src/Database/Schemas/MysqlSchema.php
public function unique($name, array $colmuns)
    {
        if (is_array($colmuns)) {
            $query = "CONSTRAINT $name UNIQUE (";
            //
            for ($i = 0; $i < Collection::count($colmuns); $i++) {
                if ($i == Collection::count($colmuns) - 1) {
                    $query .= $colmuns[$i];
                } else {
                    $query .= $colmuns[$i].',';
                }
            }
            $query .= ')';
            //
            self::$colmuns[] = $query;
        }
        //
        return $this;
    }
public function unique($name, array $colmuns)
    {
        if (is_array($colmuns)) {
            $query = "CONSTRAINT $name UNIQUE (";
            //
            for ($i = 0; $i < Collection::count($colmuns); $i++) {
                if ($i == Collection::count($colmuns) - 1) {
                    $query .= $colmuns[$i];
                } else {
                    $query .= $colmuns[$i].',';
                }
            }
            $query .= ')';
            //
            self::$colmuns[] = $query;
        }
        //
        return $this;
    }
public function unique ( $ name , array $ colmuns ) { if ( is_array ( $ colmuns ) ) { $ query = "CONSTRAINT $name UNIQUE (" ; // for ( $ i = 0 ; $ i < Collection :: count ( $ colmuns ) ; $ i ++ ) { if ( $ i == Collection :: count ( $ colmuns ) - 1 ) { $ query .= $ colmuns [ $ i ] ; } else { $ query .= $ colmuns [ $ i ] . ',' ; } } $ query .= ')' ; // self :: $ colmuns [ ] = $ query ; } // return $ this ; }
function to add unique constraint.

@param string $table
@param array  $colmuns

@return schema
function to add unique constraint .