diff options
| author | kaniini <ariadne@dereferenced.org> | 2019-07-15 13:00:33 +0000 |
|---|---|---|
| committer | kaniini <ariadne@dereferenced.org> | 2019-07-15 13:00:33 +0000 |
| commit | d725ccfd3adce35c91c9d55414f47022bf0d67ed (patch) | |
| tree | 38361610903bd6034f6a66dcd9e747e187d328d9 /priv/repo/migrations | |
| parent | 46ef8f021635c630bcd6973e6fbb7c58bcafb6bf (diff) | |
| parent | de13c9bb8fc08b12d9694f63f92935ba39a51118 (diff) | |
| download | pleroma-d725ccfd3adce35c91c9d55414f47022bf0d67ed.tar.gz pleroma-d725ccfd3adce35c91c9d55414f47022bf0d67ed.zip | |
Merge branch 'feature/addressable-lists' into 'develop'
[#802] Add addressable lists
See merge request pleroma/pleroma!1113
Diffstat (limited to 'priv/repo/migrations')
| -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 |
