[openstreetmap/openstreetmap-website] Copies notes details from first comments to notes table (PR #5667)
Tom Hughes
notifications at github.com
Thu Feb 13 18:47:50 UTC 2025
tomhughes left a comment (openstreetmap/openstreetmap-website#5667)
I think this will do the job, obviously with batches of note IDs in the CTE expression:
```sql
WITH first_comment AS(
SELECT DISTINCT ON (note_id) *
FROM note_comments
WHERE note_id BETWEEN 1000 AND 2000
ORDER BY note_id, id
)
UPDATE notes
SET description = first_comment.body,
user_id = first_comment.author_id,
user_ip = first_comment.author_ip
FROM first_comment
WHERE first_comment.note_id = notes.id
AND first_comment.event = 'opened';
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5667#issuecomment-2657452086
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5667/c2657452086 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250213/be7577e1/attachment-0001.htm>
More information about the rails-dev
mailing list