Status | Assigned | Task | ||
---|---|---|---|---|
Migrated | gitlab-migration | T339 add missing "length" property to revision.metadata JSON for all imported tar/zip | ||
Migrated | gitlab-migration | T345 Update db swh.revision.metadata data with tarball length |
Event Timeline
Comment Actions
Query sample to update jsonb field:
softwareheritage-dev=# begin; BEGIN softwareheritage-dev=# select metadata#>'{original_artifact,0,name}' as name, metadata#>'{original_artifact,0,length}' as length softwareheritage-dev-# from revision softwareheritage-dev-# where id ='\xcd065c4537de129de7b4cc6a5bebfeb09247fc14'; name | length --------------------------+-------- "talkfilters-1.0.tar.gz" | (1 row) softwareheritage-dev=# update revision softwareheritage-dev-# set metadata = jsonb_set(metadata, '{original_artifact,0,length}', '10') softwareheritage-dev-# where id = '\xcd065c4537de129de7b4cc6a5bebfeb09247fc14'; UPDATE 1 softwareheritage-dev=# select metadata#>'{original_artifact,0,name}' as name, metadata#>'{original_artifact,0,length}' as length from revision where id ='\xcd065c4537de129de7b4cc6a5bebfeb09247fc14'; name | length --------------------------+-------- "talkfilters-1.0.tar.gz" | 10 (1 row) softwareheritage-dev=# rollback; ROLLBACK
source: http://www.postgresql.org/docs/9.5/static/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE + tinkering in psql