diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-16 16:19:19 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-16 16:19:19 +0300 |
commit | 9bca70b10a4c1a7664616b90c50c10c2a8a1003e (patch) | |
tree | d228fe80c6ed7869e4b24fd758b03d2ab489d7d6 /priv/repo | |
parent | b052a9d4d0323eb64c0a741a499906659a674244 (diff) | |
parent | d3b922276138cf7aaa896d52a8e35113a40e22dc (diff) | |
download | pleroma-9bca70b10a4c1a7664616b90c50c10c2a8a1003e.tar.gz pleroma-9bca70b10a4c1a7664616b90c50c10c2a8a1003e.zip |
Merge develop
Diffstat (limited to 'priv/repo')
-rw-r--r-- | priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs b/priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs new file mode 100644 index 000000000..3c32bc355 --- /dev/null +++ b/priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs @@ -0,0 +1,26 @@ +defmodule Pleroma.Repo.Migrations.AddApIdToLists do + use Ecto.Migration + + def up do + alter table(:lists) do + add(:ap_id, :string) + end + + execute(""" + UPDATE lists + SET ap_id = u.ap_id || '/lists/' || lists.id + FROM users AS u + WHERE lists.user_id = u.id + """) + + create(unique_index(:lists, :ap_id)) + end + + def down do + drop(index(:lists, [:ap_id])) + + alter table(:lists) do + remove(:ap_id) + end + end +end |