Skip to content

Wiki::createArticle inserts 'sortIndex' (camelCase) while schema + 6 other repos use 'sortindex' (lowercase) — Postgres rejects #3382

@cleanshiptech

Description

@cleanshiptech

Affected version: 3.7.3
Database: PostgreSQL 15

Bug: app/Domain/Wiki/Repositories/Wiki.php line ~187 (in createArticle):

$id = $this->dbConnection->table('zp_canvas_items')->insertGetId([
...
'sortIndex' => '10', // <-- camelCase
]);
But the schema (SchemaBuilder.php line 173: $table->integer('sortindex')) and every other reference to this column uses lowercase:

Wiki.php itself elsewhere: ->select(... 'sortindex', ...), $article->sortindex = $row->sortindex
Canvas/Repositories/Canvas.php: 'zp_canvas_items.sortindex'
Goalcanvas/Repositories/Goalcanvas.php: 'zp_canvas_items.sortindex'
Tickets/Repositories/Tickets.php: ->orderBy('zp_tickets.sortindex', 'ASC')
Projects/Services/Projects.php: 'sortindex' => $item['sortindex']
Ideas/Repositories/Ideas.php: ['sortindex' => (int) $idea['sortIndex']]
MySQL is case-insensitive on column identifiers → the INSERT works. Postgres quotes-and-preserves-case → column "sortIndex" of relation "zp_canvas_items" does not exist on first article creation.

Proposed fix: One-character change at line 187: 'sortIndex' → 'sortindex'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions