projects
/
akkoma
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Migrations: Add index on client_id and client_secret for apps.
[akkoma]
/
priv
/
repo
/
migrations
/
20190516112144_add_ap_id_to_lists.exs
1
defmodule Pleroma.Repo.Migrations.AddApIdToLists do
2
use Ecto.Migration
3
4
def up do
5
alter table(:lists) do
6
add(:ap_id, :string)
7
end
8
9
execute("""
10
UPDATE lists
11
SET ap_id = u.ap_id || '/lists/' || lists.id
12
FROM users AS u
13
WHERE lists.user_id = u.id
14
""")
15
16
create(unique_index(:lists, :ap_id))
17
end
18
19
def down do
20
drop(index(:lists, [:ap_id]))
21
22
alter table(:lists) do
23
remove(:ap_id)
24
end
25
end
26
end