Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore missing track CIDs with cid_data #6327

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
UPDATE
tracks
SET
track_cid = subquery.track_cid
FROM
(
SELECT
tracks.track_id,
cid_data.data ->> 'track_cid' AS track_cid
FROM
tracks
JOIN users ON (users.user_id = tracks.owner_id)
JOIN cid_data ON (tracks.metadata_multihash = cid_data.cid)
WHERE
tracks.track_cid is NULL
AND is_delete = false
AND tracks.is_available = true
AND users.is_available = true
) AS subquery
WHERE
tracks.track_id = subquery.track_id
and subquery.track_cid is not null;