Add ap_id to List
This commit is contained in:
parent
fc7246d715
commit
f2936e0a07
5 changed files with 43 additions and 43 deletions
26
priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs
Normal file
26
priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue