CI_DB_forge::add_key PHP Method

add_key() public method

Add Key
public add_key ( string $key, boolean $primary = FALSE ) : CI_DB_forge
$key string
$primary boolean
return CI_DB_forge
    public function add_key($key, $primary = FALSE)
    {
        // DO NOT change this! This condition is only applicable
        // for PRIMARY keys because you can only have one such,
        // and therefore all fields you add to it will be included
        // in the same, composite PRIMARY KEY.
        //
        // It's not the same for regular indexes.
        if ($primary === TRUE && is_array($key)) {
            foreach ($key as $one) {
                $this->add_key($one, $primary);
            }
            return $this;
        }
        if ($primary === TRUE) {
            $this->primary_keys[] = $key;
        } else {
            $this->keys[] = $key;
        }
        return $this;
    }