Revert awfully long migration from 568e34858
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 29 Mar 2019 00:57:02 +0000 (01:57 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 29 Mar 2019 00:57:02 +0000 (01:57 +0100)
priv/repo/migrations/20190325215156_update_status_reply_count.exs [deleted file]

diff --git a/priv/repo/migrations/20190325215156_update_status_reply_count.exs b/priv/repo/migrations/20190325215156_update_status_reply_count.exs
deleted file mode 100644 (file)
index 50f1fe1..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-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