summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200401072456_users_add_inboxes.exs
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2020-04-01 07:47:07 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2020-04-10 06:20:02 +0200
commit62656ab259cec1a8585abecf45096b283fa4c60a (patch)
tree53662dc406811afe8f9a332ae91e20887e6f03dc /priv/repo/migrations/20200401072456_users_add_inboxes.exs
parent369c03834c5f2638080ff515055723e6c1c716bf (diff)
downloadpleroma-62656ab259cec1a8585abecf45096b283fa4c60a.tar.gz
pleroma-62656ab259cec1a8585abecf45096b283fa4c60a.zip
User: Move inbox & shared_inbox to own fields
Diffstat (limited to 'priv/repo/migrations/20200401072456_users_add_inboxes.exs')
-rw-r--r--priv/repo/migrations/20200401072456_users_add_inboxes.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200401072456_users_add_inboxes.exs b/priv/repo/migrations/20200401072456_users_add_inboxes.exs
new file mode 100644
index 000000000..0947f0ab2
--- /dev/null
+++ b/priv/repo/migrations/20200401072456_users_add_inboxes.exs
@@ -0,0 +1,20 @@
+defmodule Pleroma.Repo.Migrations.UsersAddInboxes do
+ use Ecto.Migration
+
+ def up do
+ alter table(:users) do
+ add_if_not_exists(:inbox, :text)
+ add_if_not_exists(:shared_inbox, :text)
+ end
+
+ execute("UPDATE users SET inbox = source_data->>'inbox'")
+ execute("UPDATE users SET shared_inbox = source_data->'endpoints'->>'sharedInbox'")
+ end
+
+ def down do
+ alter table(:users) do
+ remove_if_exists(:inbox, :text)
+ remove_if_exists(:shared_inbox, :text)
+ end
+ end
+end