protected function _buildDefinition($columns, $constraints)
    {
        foreach ($columns as $name => $field) {
            $field['name'] = $name;
            $field = $this->dialect()->field($field);

            if (!empty($field['serial'])) {
                $primary = $name;
            }
            $result[] = $this->dialect()->column($field);
        }

        foreach ($constraints as $constraint) {
            if (!isset($constraint['type'])) {
                throw new SqlException("Missing contraint type.");
            }
            $type = $constraint['type'];
            if ($meta = $this->dialect()->constraint($type, $constraint, ['schemas' => ['' => $this]])) {
                $result[] = $meta;
            }
            if ($type === 'primary') {
                $primary = null;
            }
        }
        if (isset($primary)) {
            $result[] = $this->dialect()->constraint('primary', ['column' => $primary]);
        }

        return ' (' . join(', ', array_filter($result)) . ')';
    }