summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2019-02-05 20:27:31 +0000
committerkaniini <nenolod@gmail.com>2019-02-05 20:27:31 +0000
commitd120aa63f0b2e688b292af5a9afe45ab45c8e10b (patch)
treeccd2523bd439695ca75f355904375b979029e3ac /priv/repo/migrations
parent681ba1e52f3ef27eb6b2407dfe85939714f67925 (diff)
parentf3c8b02d65f6abc8263c73c10c9028606bfe6894 (diff)
downloadpleroma-d120aa63f0b2e688b292af5a9afe45ab45c8e10b.tar.gz
pleroma-d120aa63f0b2e688b292af5a9afe45ab45c8e10b.zip
Merge branch 'fix-dm-index' into 'develop'
Massage index until it actually does the stuff we want. See merge request pleroma/pleroma!772
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20190204200237_add_correct_dm_index.exs30
1 files changed, 30 insertions, 0 deletions
diff --git a/priv/repo/migrations/20190204200237_add_correct_dm_index.exs b/priv/repo/migrations/20190204200237_add_correct_dm_index.exs
new file mode 100644
index 000000000..558732cd2
--- /dev/null
+++ b/priv/repo/migrations/20190204200237_add_correct_dm_index.exs
@@ -0,0 +1,30 @@
+defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do
+ use Ecto.Migration
+ @disable_ddl_transaction true
+
+ def up do
+ drop_if_exists(
+ index(:activities, ["activity_visibility(actor, recipients, data)"],
+ name: :activities_visibility_index
+ )
+ )
+
+ create(
+ index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC NULLS LAST"],
+ name: :activities_visibility_index,
+ concurrently: true,
+ where: "data->>'type' = 'Create'"
+ )
+ )
+ end
+
+ def down do
+ drop(
+ index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC"],
+ name: :activities_visibility_index,
+ concurrently: true,
+ where: "data->>'type' = 'Create'"
+ )
+ )
+ end
+end