protected function getPrimaryConstraint($force = false)
    {
        if ($this->primary_constraint === null || $force) {
            $this->primary_constraint = null;
            if (array_key_exists('constraints', $this->storage_descriptor)) {
                foreach ($this->storage_descriptor['constraints'] as $constraint) {
                    if (is_array($constraint) &&
                        array_key_exists('primary', $constraint) &&
                        $constraint['primary'] === true
                    ) {
                        $this->primary_constraint = $constraint;
                        break;
                    }
                }
            }
        }

        return $this->primary_constraint;
    }