Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
normandy
pleroma
Commits
b2f3a40e
Verified
Commit
b2f3a40e
authored
5 years ago
by
Haelwenn
Browse files
Options
Downloads
Patches
Plain Diff
Revert awfully long migration from
568e3485
parent
a71831d1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
priv/repo/migrations/20190325215156_update_status_reply_count.exs
+0
-48
0 additions, 48 deletions
...o/migrations/20190325215156_update_status_reply_count.exs
with
0 additions
and
48 deletions
priv/repo/migrations/20190325215156_update_status_reply_count.exs
deleted
100644 → 0
+
0
−
48
View file @
a71831d1
defmodule
Pleroma
.
Repo
.
Migrations
.
UpdateStatusReplyCount
do
use
Ecto
.
Migration
@public
"https://www.w3.org/ns/activitystreams#Public"
def
up
do
execute
(
"""
WITH reply_count AS (
SELECT count(*) AS count, data->>'inReplyTo' AS ap_id
FROM objects
WHERE
data->>'inReplyTo' IS NOT NULL AND
data->>'type' = 'Note' AND (
data->'cc' ? '#{@public}' OR
data->'to' ? '#{@public}')
GROUP BY data->>'inReplyTo'
)
UPDATE objects AS o
SET "data" = jsonb_set(o.data, '{repliesCount}', reply_count.count::varchar::jsonb, true)
FROM reply_count
WHERE reply_count.ap_id = o.data->>'id';
"""
)
execute
(
"""
WITH reply_count AS (SELECT
count(*) as count,
data->'object'->>'inReplyTo' AS ap_id
FROM
activities
WHERE
data->'object'->>'inReplyTo' IS NOT NULL AND
data->'object'->>'type' = 'Note' AND (
data->'object'->'cc' ? '#{@public}' OR
data->'object'->'to' ? '#{@public}')
GROUP BY
data->'object'->>'inReplyTo'
)
UPDATE activities AS a
SET "data" = jsonb_set(a.data, '{object, repliesCount}', reply_count.count::varchar::jsonb, true)
FROM reply_count
WHERE reply_count.ap_id = a.data->'object'->>'id';
"""
)
end
def
down
do
:noop
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment