Skip to content

Better item_version_detail view #37

@simonw

Description

@simonw

Including the list of columns is useful:

select
  commits.commit_at as _commit_at,
  commits.hash as _commit_hash,
  item_version.*,
  (
    select json_group_array(name) from columns
    where id in (
      select column from item_changed
      where item_version = item_version._id
    )
  ) as changed_columns
from
  item_version
  join commits on commits.id = item_version._commit
  join item_changed on item_version._id = item_changed.item_version

I tried this with a join and group by instead of that nested select json_group_array but the performance was terrible, presumably because it has to calculate for every single row as opposed to the subset of rows returned on the page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions